Question regarding values persisting from play mode
I'm running into a very odd behavior that I'm hoping you can help with.
I've set up a tutorial in my project and, in the midst of testing, have found that it is affecting other scripts in my project. Specifically, I have a script that has some public int and bool value. Let's say that all of the ints are set to 0 and the bools false in the editor. When I enter play mode, all of those ints get set to 1 and the bools to true. Upon leaving play mode, I would expect that they would return to their default values of false and 0. It seems that, as long as I have a Tutorial Designer window active, this is not the case. The values persist from play mode back to the editor.
I hope the description of the issue makes sense. Do you have any ideas what could be causing this?
Thanks in advance!
I take it back. The problem persists even with tutorial designer closed.
Still, if you have any ideas I'd appreciate it. I'm stumped here.
Please just delete this thread. The problem had nothing to do with your asset and everything to do with changes made to unity's Cinemachine in the 2017 update.
Sorry about that.
Migoun last edited by
wow that sounds strange. Maybe it helps to run Monodevelop / VS in Debug Mode and watch the variables.
And keep in mind that the Inspector always overrides variables in your script. This of course only counts for public variables, because you cannot see privates in the Inspector.
It was driving me crazy as it was working fine in Unity 5.6 and then I upgraded to 2017.1. In the process I also upgraded to the new CineMachine BaseRig. The previous version created a game object that had the CineMachine brains attached to it, where the new version attaches this component directly to the Main Camera.
The problem I was facing was a direct result of this as I also had the script in question attached to the Main Camera. It was CineMachine that was forcing the changes that occurred in play mode to persist back to edit more. In fact, it happened very quickly after hitting stop, but I could see the changes being applied. The only reason I suspected Tutorial Designer was because it looked like it didn't happen a couple of times after I closed my TD windows.
Thanks for taking the time to reply. I do appreciate it (and TD is playing a very active role in my new game).
All the best,