Hey people, I’m new to Unity and have a question:
Talking about class communication I learned somewhere on the way (or perhaps I made it up) that the main class should instruct other classes what to do, so for instance I do this:
Main class:
if (selectBox.selListUpdated == true) {
selectedItems = selectBox.selectedItemsList;
selectBox.selListUpdated = false;
}
Then in the ‘selectBox’ class I update ‘selectedShipsList’ and set ‘selListUpdated’ to true.
This however makes the main class check for the ‘selListUpdated’ boolean every frame.
If I just make ‘selectBox’ update the main class after it has updated it it would be less impact on performance right?
Is this best practice in Unity?
I’m not sure what the impact is of adding a reference to main in the ‘selectBox’ class - esp since I can add it to the Awake function it should not be any impact at all?