Whenever I switch the main State, I like to print it in console too, just for confirmation, something simple like OnStart of a state:
Code: Select all
trace(NL + "...entering state_BattleG");
and OnLeave:
So this works perfectly but is a bit troublesome to maintain (for example if I change the name of the state I have to go to two different ZExpressions placed in two different nodes in the Project Tree and update it there too) and has some other drawbacks… Can this be automated to at least some extent? For example if I could make a component like this
Code: Select all
trace(NL + "...entering: " + StateSwitch.State);
and call this whenever needed (but obviously I can't get the string / name of the state like this) it'd be easier… But then again I would not be able to use this for leaving a State anyway, because I have to set the StateSwitch.State to "StateSwitch.State = null;" after each switch (so I can't know where it came from and I can't have the "now leaving" part).
So I don't have any better ideas how'd I set this up without overcomplicating such a simple task

Is there some obvious way to go about it that I'm missing
