Hello,
I have a static
class
and wanted to use the Start()
method within it. But it did not work. So I googled and found out that I cannot use it outside of MonoBehavior
. Unfortunately I did not find out, what I can use instead. I need to create references to another scripts, when the game starts.
My code:
public static class Helper
{
public static StateData data;
public static StateManager stateManager;
public static void Start()
{
Transform player = GameObject.FindWithTag("Player").transform;
stateManager = player.GetComponent<ProcanimStateManager>();
data = stateManager.data;
}
...
}
In what other way can I create the references just once I start the game?
Thank you
Huxi