Dictionaries Not Reloading on Recompile?

I noticed that whenever I make a change in the script and go back to the Unity window (which automatically recompiles the scripts), the Dialogue ScriptableObject no longer has the node lookup table populated. Basically it seems like the Awake() method in the ScriptableObject isn’t being called to reload the node lookup table when we recompile. This causes an issue in the next lecture where when we try to get children using the lookup table to draw the connecting node curves, the table is empty, so no all the curves disappear if the scripts were just reloaded. I guess this behavior makes sense, b/c only if we close and restart Unity do we actually load the ScriptableObject assets again (triggering the Awake() method), but it’s a little bit frustrating to have to close and reopen Unity entirely. So I was wondering if there was a way to reload the node lookup table when the scripts recompile (is there an equivalent to Awake() that is triggered on scripts recompiling)? Thanks.

Whoops, I actually figured this out! The OnValidate() function that we are using is what reloads the table when the scripts recompile, I just didn’t capitalize the name exactly.

1 Like

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

Privacy & Terms