Question about variable on inactive object
I have a variable on a component that is attached to a UI panel. I need this value from other scripts and because the value was loaded during the start() method calling the get() method on the class returned 0 until the panel was displayed. I moved the logic that does the loading into a separate method and call it from my game manager class. So essentially in the start method of my game manager I call instanceOfComponentOnInactiveObject.loadData();
Just curious if this is the best way to do it. I know that I could just add a canvas group and hide the panel instead of disabling it but the update method has code that really has no need to be run when that panel isn't visible and there is no way the data would change after load unless that panel was open and a button on it was pressed. So my current solution leads to it being called just once.
Your answer
![](https://koobas.hobune.stream/wayback/20220612104753im_/https://answers.unity.com/themes/thub/images/avi.jpg)