Page 1 of 1

Possible Variables bug but...

Posted: Fri Mar 16, 2018 8:32 am
by Abelius
...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. :P

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.

Re: Possible Variables bug but...

Posted: Fri Mar 16, 2018 2:01 pm
by Tony Li
I'll investigate the Watches tab. You can trust the Lua Console, since it's just a straight pull from Lua. The Watches tab does some interpretation and caching that may be making incorrect assumptions.

Re: Possible Variables bug but...

Posted: Sat Mar 17, 2018 9:53 am
by Abelius
Caching you say... I guess that's the reason we have that 'refresh list' option there. But when I refresh it... well, weirdness happens as I've already said. Not wanting to repeat myself. :P

Thank you for looking into this. I'd really like to use the Watches feature to its full potential.

Re: Possible Variables bug but...

Posted: Sat Mar 17, 2018 10:12 am
by Tony Li
I should have a patch available for you later today. The Watches tab is much smarter now. I was able to retain a lot of the performance optimizations without adding the assumptions that the previous caching method used.

Re: Possible Variables bug but...

Posted: Sat Mar 17, 2018 10:06 pm
by Tony Li
Patch 20170317 on now live on the customer download site. (If anyone needs access, please PM me your Unity Asset Store invoice number.)

Added in this patch:
  • [03/17] Dialogue Editor:
    - Added node copy/paste.
    - Added zoom at cursor.
    - Improved snap to grid behavior.
    - Added quest & quest entry dropdowns to Watches.
    - Fixed Watches bug that reported invalid cached info.
  • [03/17] Added DialogueTime dropdown to Dialogue Manager.
  • [03/17] Added Sequence field to Condition Observer.
  • [03/17] Add [Actor] popup attribute for scripts.
  • [03/17] NGUI: Quest tracker now manually calls Reposition in case table doesn’t auto-reposition.
  • [03/17] plyGame: Updated save/load system integration.

Re: Possible Variables bug but...

Posted: Sun Mar 18, 2018 10:05 am
by Abelius
Thank you so much!

And it has a lot of other nice things as well!

I'll install it this afternoon and enjoy it. πŸ˜‹

Oh, and I'll also try to break Watchers again...

Re: Possible Variables bug but...

Posted: Sun Mar 18, 2018 3:51 pm
by Abelius
Hi there Tony,

Some feedback on the patch.

First of all, a big thank you! The Watchers feature seems to be working now and that will be so frigging useful that I almost cried. :lol:

You also fixed the node context menu position! That was so annoying! :roll:

That copy/paste feature is also epic! We've been gleefully waiting for it. :mrgreen: The only little issue I've noticed is that when you finally paste the node/s, they don't end up being positioned on the mouse cursor, but far away. You actually need to zoom out and look for them.

Zoom to cursor. Another nifty feature. However, it could be more responsive, because when I zoom into an area close to the editor window border, it doesn't actually "move" to that area. It zooms in taking the current border as a pivot (I think). Well, it actually translates a little, but I think the amount should be more noticeable, so I don't end up needing to do what I was previously doing: middle-click the mouse to translate the whole editor window.

Snap to grid. Now it's working nicely, snapping to the lines in the background. Thanks! There's one tiny problem though, that was already present when it was introduced: if you try to move multiple nodes, only the first selected is the one that snaps. I can figure that "fixing" this must not be easy, so I don't really mind much.

In short, I'm very grateful for this update! I don't know if my productivity has improved, but certainly my frustration has decreased a lot! :lol:

Re: Possible Variables bug but...

Posted: Sun Mar 18, 2018 4:31 pm
by Tony Li
Hi,
Abelius wrote: ↑Sun Mar 18, 2018 3:51 pmThat copy/paste feature is also epic! We've been gleefully waiting for it. :mrgreen: The only little issue I've noticed is that when you finally paste the node/s, they don't end up being positioned on the mouse cursor, but far away. You actually need to zoom out and look for them.
I once again forgot to account for zoom levels. If you're not zoomed in or out, it should position more nicely. I'll fix this.
Abelius wrote: ↑Sun Mar 18, 2018 3:51 pmZoom to cursor. Another nifty feature. However, it could be more responsive, because when I zoom into an area close to the editor window border, it doesn't actually "move" to that area.
If I have time to tweak this before the 1.7.7.3 release, I'll fix it. Otherwise I may need to leave it for the next release/patch cycle.
Abelius wrote: ↑Sun Mar 18, 2018 3:51 pmSnap to grid. Now it's working nicely, snapping to the lines in the background. Thanks! There's one tiny problem though, that was already present when it was introduced: if you try to move multiple nodes, only the first selected is the one that snaps. I can figure that "fixing" this must not be easy, so I don't really mind much.
Do you have any suggestions for how it should work? Currently the other nodes retain their relative position to the selected node. Previously, each node would align to the grid spacing, but this changed their positions relative to each other, which didn't look good.

Re: Possible Variables bug but...

Posted: Sun Mar 18, 2018 7:08 pm
by Abelius
Tony Li wrote: ↑Sun Mar 18, 2018 4:31 pm Do you have any suggestions for how it should work? Currently the other nodes retain their relative position to the selected node. Previously, each node would align to the grid spacing, but this changed their positions relative to each other, which didn't look good.
Mmm... could it be that those other nodes weren't previously aligned to the grid? That would explain why they didn't snap relative to the selected "guide" node, but to their respective nearest snapping point when dragged for the first time, right?

I think that behavior would be acceptable, because aligning them to the grid when first created would be an instinctive action for me to do. I mean, if all of them are already aligned, I assume they should behave exactly as the selected node when moving them, even in a group, right?

Anyway, this is not a critical issue. ;)

Re: Possible Variables bug but...

Posted: Sun Mar 18, 2018 8:07 pm
by Tony Li
Okay, two issues are on the slate for version 1.8.0. (I'm releasing 1.7.7.3 tomorrow.)

1. Improve zooming on the cursor position.

2. When starting to drag multiple nodes, align each to its nearest grid position. Then, as you continue dragging, keep them in their relative positions to the first node.