Unity3d-Finite-State-Machine icon indicating copy to clipboard operation
Unity3d-Finite-State-Machine copied to clipboard

StateMachine.Driver is null after unity hot code reload

Open Relecto opened this issue 1 year ago • 0 comments

Hi! So let's say I have a default state machine:

protected StateMachine<States> fsm;

and in Update() I call fsm.Driver.Update.Invoke();

void Update() {
    fsm.Driver.Update.Invoke();
}

It works well, but it looks like that Driver field is not preserved after a code reload while the game is running

NullReferenceException: Object reference not set to an instance of an object
QT.Entity.Update () (at Script.cs:137)

Is this an expected behaviour, or am I using it wrong? If it is expected, is there a way we could preserve that field between reloads?

Relecto avatar Nov 26 '23 12:11 Relecto