You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Oh gosh Unity never unloads ScriptableObjects once created! This fixes it but is more of an expensive call than I like.
50
+
// I've commented this out in favour of a callback approach - see OnEnable. Left this for posterity in case we need to return to this.
51
+
// foreach (var settings in Resources.FindObjectsOfTypeAll<InkSettings>()) {
52
+
// if(settings == instance) continue;
53
+
// DestroyImmediate(settings);
54
+
// }
49
55
}
50
56
return_instance;
51
57
}privateset{
@@ -84,6 +90,8 @@ public string templateFilePath {
84
90
publicintcompileTimeout=30;
85
91
86
92
publicboolprintInkLogsInConsoleOnCompile;
93
+
94
+
publicboolsuppressStartupWindow;
87
95
88
96
#if UNITY_EDITOR&&!UNITY_2018_1_OR_NEWER
89
97
[MenuItem("Edit/Project Settings/Ink",false,500)]
@@ -102,6 +110,10 @@ public bool ShouldCompileInkFileAutomatically (InkFile inkFile) {
102
110
103
111
104
112
voidOnEnable(){
113
+
// Oh gosh Unity never unloads ScriptableObjects once created! We destroy these objects before we recompile so there's only ever one in memory at once.
114
+
AssemblyReloadEvents.beforeAssemblyReload+=()=>{
115
+
DestroyImmediate(this);
116
+
};
105
117
// Validate the includeFilesToCompileAsMasterFiles list.
settings.templateFile=(DefaultAsset)EditorGUILayout.ObjectField(newGUIContent("Ink Template","Optional. The default content of files created via Assets > Create > Ink."),settings.templateFile,typeof(DefaultAsset));
64
+
settings.templateFile=(DefaultAsset)EditorGUILayout.ObjectField(newGUIContent("Ink Template","Optional. The default content of files created via Assets > Create > Ink."),settings.templateFile,typeof(DefaultAsset));
61
65
62
66
settings.defaultJsonAssetPath=(DefaultAsset)EditorGUILayout.ObjectField(newGUIContent("New JSON Path","By default, story JSON files are placed next to the ink. Drag a folder here to place new JSON files there instead."),settings.defaultJsonAssetPath,typeof(DefaultAsset));
63
67
settings.compileAllFilesAutomatically=EditorGUILayout.Toggle(newGUIContent("Compile All Ink Automatically","When disabled, automatic compilation can be enabled on a per-story basis via the inspector for a master story file. This can be helpful when you have several stories in a single project."),settings.compileAllFilesAutomatically);
64
68
settings.delayInPlayMode=EditorGUILayout.Toggle(newGUIContent("Delay compilation if in Play Mode","When enabled, ink compilation is delayed if in play mode. Files will be compiled on re-entering edit mode."),settings.delayInPlayMode);
65
69
settings.printInkLogsInConsoleOnCompile=EditorGUILayout.Toggle(newGUIContent("Print ink TODOs in console on compile","When enabled, ink lines starting with TODO are printed in the console."),settings.printInkLogsInConsoleOnCompile);
66
70
settings.handleJSONFilesAutomatically=EditorGUILayout.Toggle(newGUIContent("Handle JSON Automatically","Whether JSON files are moved, renamed and deleted along with their ink files."),settings.handleJSONFilesAutomatically);
67
71
settings.compileTimeout=EditorGUILayout.IntField(newGUIContent("Compile Timeout","The max time the compiler will attempt to compile for in case of unhanded errors. You may need to increase this for very large ink projects."),settings.compileTimeout);
72
+
settings.suppressStartupWindow=EditorGUILayout.Toggle(newGUIContent("Suppress Startup Window","Prevent the \"what's new\" (the one that appears if you click the \"Show changelog\" button above) appearing when the version of this plugin has changed and Unity is opened. This can be useful for CI/CD pipelines, where auto-launching editor windows can fail to load due to a Unity bug."),settings.suppressStartupWindow);
EditorGUILayout.PropertyField(settings.FindProperty("printInkLogsInConsoleOnCompile"),newGUIContent("Print ink TODOs in console on compile","When enabled, ink lines starting with TODO are printed in the console."));
90
104
EditorGUILayout.PropertyField(settings.FindProperty("handleJSONFilesAutomatically"),newGUIContent("Handle JSON Automatically","Whether JSON files are moved, renamed and deleted along with their ink files."));
91
105
EditorGUILayout.PropertyField(settings.FindProperty("compileTimeout"),newGUIContent("Compile Timeout","The max time the compiler will attempt to compile for in case of unhanded errors. You may need to increase this for very large ink projects."));
106
+
EditorGUILayout.PropertyField(settings.FindProperty("suppressStartupWindow"),newGUIContent("Suppress Startup Window","Prevent the \"what's new\" (the one that appears if you click the \"Show changelog\" button above) appearing when the version of this plugin has changed and Unity is opened. This can be useful for CI/CD pipelines, where auto-launching editor windows can fail to load due to a Unity bug."));
EditorGUILayout.TextField(newGUIContent("Ink story format version","Significant changes to the Ink runtime are recorded by the story format version.\nCompatibility between different versions is limited; see comments at Ink.Runtime.Story.inkVersionCurrent for more details."),Ink.Runtime.Story.inkVersionCurrent.ToString());
106
124
EditorGUILayout.TextField(newGUIContent("Ink save format version","Version of the ink save/load system.\nCompatibility between different versions is limited; see comments at Ink.Runtime.StoryState.kInkSaveStateVersion for more details."),Ink.Runtime.StoryState.kInkSaveStateVersion.ToString());
EditorGUILayout.LabelField("• Adds InkSettings.suppressStartupWindow, which can be used to prevent this window from appearing (requested for some CI/CD pipelines).",EditorStyles.wordWrappedLabel);
82
+
EditorGUILayout.LabelField("• Adds links to Discord for community support in help menu, startup window and setting menu.",EditorStyles.wordWrappedLabel);
83
+
EditorGUILayout.LabelField("• Fixes an issue where InkSettings ScriptableObjects wouldn't be unloaded.",EditorStyles.wordWrappedLabel);
84
+
EditorGUILayout.EndVertical();
75
85
// 1.1.1
76
86
EditorGUILayout.BeginVertical(GUI.skin.box);
77
-
EditorGUILayout.LabelField("Updates ink to 1.1.1.",EditorStyles.boldLabel);
78
-
EditorGUILayout.LabelField("The InkCompiler.OnCompileInk event now fires once when the compilation stack completes and returns an array of compiled files",EditorStyles.wordWrappedLabel);
79
-
EditorGUILayout.LabelField("Fixes some async threading issues when compiling",EditorStyles.wordWrappedLabel);
80
-
EditorGUILayout.LabelField("Adds JSON formatting for save states copied or saved via the Ink Player Window",EditorStyles.wordWrappedLabel);
81
-
EditorGUILayout.LabelField("Use the Unity Progress API to show compilation. Useful for large ink projects!",EditorStyles.wordWrappedLabel);
82
-
EditorGUILayout.LabelField("Included files now show their own included files in the Inspector",EditorStyles.wordWrappedLabel);
EditorGUILayout.LabelField("• Updates ink to 1.1.1.",EditorStyles.wordWrappedLabel);
89
+
EditorGUILayout.LabelField("• The InkCompiler.OnCompileInk event now fires once when the compilation stack completes and returns an array of compiled files",EditorStyles.wordWrappedLabel);
90
+
EditorGUILayout.LabelField("• Fixes some async threading issues when compiling",EditorStyles.wordWrappedLabel);
91
+
EditorGUILayout.LabelField("• Adds JSON formatting for save states copied or saved via the Ink Player Window",EditorStyles.wordWrappedLabel);
92
+
EditorGUILayout.LabelField("• Use the Unity Progress API to show compilation. Useful for large ink projects!",EditorStyles.wordWrappedLabel);
93
+
EditorGUILayout.LabelField("• Included files now show their own included files in the Inspector",EditorStyles.wordWrappedLabel);
94
+
EditorGUILayout.LabelField("• Various optimisations",EditorStyles.wordWrappedLabel);
0 commit comments