playMaker

Author Topic: Variable reference missing when returning to scene.  (Read 861 times)

Softme

  • Playmaker Newbie
  • *
  • Posts: 11
Variable reference missing when returning to scene.
« on: August 31, 2022, 05:35:18 AM »
Three gameObject A B C with their own fsm.
In the b.fsm, by using Set Fsm Game Object , I set A.variable = B.self.
In the next frame, I set A.variable = C.self in the same way.

Testing in editor, hit play on Scene A. Move player to Scene B, A.variable works fine ,no issue. Move player back to Scene A and A.variable references will be lost.

All gameObject use dontdestroyOnLoad in script. If I disable b.fsm, then A.variable will not be lost. I make a simple copy of them which have same function, but the reference of the copy will not be lost.

Edit: Now I copy the whole gameObject, and disable the old, the new one works fine.Wierd
« Last Edit: August 31, 2022, 05:44:31 AM by Softme »