So i have a bit of a conundrum at the moment. I have a piece of UX (in a Canvas panel) that needs to be shown or hidden, depending on some condition in gameplay logic. Up until now I've been doing this with conditional logic in the Update method of a MonoBehaviour, i.e. something like this:
public GameObject uxPanel;
void Update()
{
if (uxShowCondition)
{
uxPanel.gameObject.SetActive(true);
}
else
{
uxPanel.gameObject.SetActive(false);
}
}
Simple and it works. The problem is that this conditional logic gets called every single frame. I know Unity is optimized for running these Update …