Possible Variables bug but...
Posted: Fri Mar 16, 2018 8:32 am
...but it's going to be hard to reproduce it well enough.
The main issue is that I've got nil values for new and even old Variables. Another related (?) issue is that the Watchers tab doesn't consistently give a correct list of all current variables.
Note that I'm using a reorderable variables list.
What I've done is the following...
1. Added several Number variables to my DS DB, and set non-zero initial values (1.5 and 0.5 in my testing variables).
2. Used them as multipliers in a script formula, and got an error ("...not set to an instance of an object" type).
3. Used the Lua console to return their values. Returned 'nil' in both.
4. Tried to use the Watchers wizard to add all runtime variables and they didn't show up.
5. Stopped the game, saved and re-run it.
6. I've got the correct values this time, but an old variable that was working before returned 'nil'.
7. Stopped the game, saved, exited Unity and re-launched it.
8. Now all variables are working fine, but when I try again to add all runtime variables with the Watchers wizard, they're not there again AND those variables start to return 'nil' values again. Big WTF moment here...
9. Clicked 'Refresh runtime variables list' option and got an even worse list (missing variables and incorrect value types).
9. Save and restart Unity.
10. Run the game, Clicked 'Reset', 'Refresh runtime variables list' and 'Add all runtime variables'.
11. This time all seems to be okay: all variables shown, correct value types and their actual values, returned non 'nil' values in Lua console as well.
It seems the Watchers tab doesn't work nicely (for me at least) in all situations. But what got me REALLY surprised was that updating the list could make the actual variables stop returning their values. That is, without doubt, very unsettling.
Oh and another issue that I've got since... well... always, is that if I tick "Update All" every 1 seconds, the values are not correct...: one Boolean switched to False just after clicking the option, and its initial value is True... And when I used the console to find out the actual value, I've got a 'nil' again!
At the end of the day, what I always do is avoiding the Watchers feature entirely, even if it would be so useful to have it.
I don't know if I'm the only one with this issue, but this is making coding very difficult as I can't have total confidence in which values I have in the game...
So, in short, what I'm doing for now, apart from using any Watcher that could mess up my variables, is to restart Unity anytime I add a variable because if I don't do that, I can't be sure of them being present in game.
Thanks for reading.
Update: I'm also having issues with Quest states.
The main issue is that I've got nil values for new and even old Variables. Another related (?) issue is that the Watchers tab doesn't consistently give a correct list of all current variables.
Note that I'm using a reorderable variables list.
What I've done is the following...
1. Added several Number variables to my DS DB, and set non-zero initial values (1.5 and 0.5 in my testing variables).
2. Used them as multipliers in a script formula, and got an error ("...not set to an instance of an object" type).
3. Used the Lua console to return their values. Returned 'nil' in both.
4. Tried to use the Watchers wizard to add all runtime variables and they didn't show up.
5. Stopped the game, saved and re-run it.
6. I've got the correct values this time, but an old variable that was working before returned 'nil'.
7. Stopped the game, saved, exited Unity and re-launched it.
8. Now all variables are working fine, but when I try again to add all runtime variables with the Watchers wizard, they're not there again AND those variables start to return 'nil' values again. Big WTF moment here...
9. Clicked 'Refresh runtime variables list' option and got an even worse list (missing variables and incorrect value types).
9. Save and restart Unity.
10. Run the game, Clicked 'Reset', 'Refresh runtime variables list' and 'Add all runtime variables'.
11. This time all seems to be okay: all variables shown, correct value types and their actual values, returned non 'nil' values in Lua console as well.
It seems the Watchers tab doesn't work nicely (for me at least) in all situations. But what got me REALLY surprised was that updating the list could make the actual variables stop returning their values. That is, without doubt, very unsettling.
Oh and another issue that I've got since... well... always, is that if I tick "Update All" every 1 seconds, the values are not correct...: one Boolean switched to False just after clicking the option, and its initial value is True... And when I used the console to find out the actual value, I've got a 'nil' again!
At the end of the day, what I always do is avoiding the Watchers feature entirely, even if it would be so useful to have it.
I don't know if I'm the only one with this issue, but this is making coding very difficult as I can't have total confidence in which values I have in the game...
So, in short, what I'm doing for now, apart from using any Watcher that could mess up my variables, is to restart Unity anytime I add a variable because if I don't do that, I can't be sure of them being present in game.
Thanks for reading.
Update: I'm also having issues with Quest states.