Big problem when making a build for the changes in this lecture

The problem is that when we erase the Awake method and just leave the OnValidate Method, the last one just works in editor mode and not when we make a build, this leads to a bug when creating a build because there’s no other method to populate the nodeLookup dictionary. So, in any dialogue the “next” button won’t appear. To fix this you should create another method that’s called in OnValidate and Awake or just copy the content from OnValidate on Awake.

3 Likes

Yes, this is a known issue. I believe Sam mentions it at some point (or there is a patch pending). OnValidate() is never called in a Built game.
The solution is to move both Awake() and OnValidate() out of the #if UNITY_EDITOR code block. Then change Awake to read

void Awake()
{
     OnValidate();
}

This will ensure that OnValidate is called and the lookp table will be ready to use.

1 Like

I was literally making a build last night for the first time and ran into this same issue. I spent all day today trying to find the cause and came to the same conclusion. Came here to post about it and saw you beat me to it by 1 day. Wish I saw this last night.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms