Skip to content

Commit 054c2e4

Browse files
author
Tom Kail
committed
A fix for the ink library system
1 parent cfcaf5e commit 054c2e4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Packages/Ink/Editor/Core/Ink Library/InkLibrary.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,19 @@ IEnumerator IEnumerable.GetEnumerator() {
8080

8181
// This occurs on recompile, creation and load (note that data has not been loaded at this point!)
8282
protected InkLibrary () {
83-
Debug.Log("CONSTRUCT "+GetInstanceID());
8483
if (created)
8584
Debug.LogError((object) "ScriptableSingleton already exists. Did you query the singleton in a constructor?");
8685
else {
8786
Instance = this;
88-
// Note that if this constructor is called as load occurs this will not be able to populate the dictionary.
89-
BuildLookupDictionary();
9087
}
9188
}
9289

93-
public static void LoadOrCreateInstance () {
94-
var inkLibraryJSON = EditorPrefs.GetString("InkLibrary");
90+
// After recompile, the data associated with the object is fetched (or whatever happens to it) by this point.
91+
void OnEnable () {
92+
BuildLookupDictionary();
93+
}
9594

95+
public static void LoadOrCreateInstance () {
9696
InternalEditorUtility.LoadSerializedFileAndForget(absoluteSavePath);
9797
if(created) {
9898
BuildLookupDictionary();
@@ -103,7 +103,6 @@ public static void LoadOrCreateInstance () {
103103
Instance.hideFlags = HideFlags.HideAndDontSave;
104104
Rebuild();
105105
SaveToFile();
106-
107106
}
108107
}
109108

0 commit comments

Comments
 (0)