Possible bug with nodeLookup dictionary

Summary:
The nodeLookup dictionary is built in the Dialogue.cs callback OnValidate. But this method is only called in the Unity Editor, so in an actual build, the dictionary is never populated. The result is that no nodes will be found to have children in GetAllChildren().

Long version:
I used the dialogue system we created here in a VR (Oculus Rift) experience I created. Everything works great in the editor but when I tried to run my app from an actual build, I couldn’t get past the first node. I finally tracked the problem to the issue I explained above. My fix was to manually run OnValidate in Awake.
Im, not 100% certain if this is an issue with me and my app, or a systemic problem, but I don’t think its me so I thought Id bring this to your attention.

Thank you for the great course, BTW,
Jason

3 Likes

In my case, I have a method PopulateDictionary() that is outside of the #if UNITY_EDITOR block. Awake() and OnValidate() both call this method.

1 Like

Cool, so you have come to a similar solution as I did.

I thought it would be helpful for Sam to mention this issue in a future video. Since the ultimate goal of these classes is to build a production app, the code as taught would not work properly.

1 Like

This topic was automatically closed after 45 hours. New replies are no longer allowed.

Privacy & Terms