3

For HP, I'd recommend creating a Health component, something like this... public class Health : MonoBehaviour { public float maxHP = 100; public UnityEvent OnDeath; float _currentHP; void Start() { _currentHP = maxHP; } public void TakeDamage(float damage) { if (_currentHP <= 0f) return; _currentHP -= ...


2

In this particular context there is no good reason to use one over the other. But in general, there are a couple things you might want to consider: Assigning buttons in the inspector requires no programming knowledge. So when you are working with a UI designer who can't program C#, then you just need to provide them with the methods the UI is supposed to ...


2

This sets GameObjects' visibility by name by enabling/disabling their MeshRenderer: static public class Utility { static public void SetVisible(string name, bool visibility = true) { GameObject.Find(name).GetComponent<MeshRenderer>().enabled = visibility; } } This makes the game object named "AnitaBath" visible by ...


1

If you're using the Unity engine and add AI scripting support with Python, that doesn't inherently give players "access to the underlying engine". The only way you'd be giving "access to the underlying engine" is if you made a Python wrapper that could access substantial portions of the Unity API, which would be a nightmare to implement. ...


1

This sets GameObjects' visibility by name by activating/deactivating them: using System.Collections.Generic; using UnityEngine; public class Utility : MonoBehaviour { static Dictionary<string, GameObject> gameObjects; public void Awake() { gameObjects = new Dictionary<string, GameObject>(); foreach (var o in ...


Only top voted, non community-wiki answers of a minimum length are eligible