public override void OnInspectorGUI() { base.OnInspectorGUI(); ChangeLightmap lightmapData = (ChangeLightmap)target; if (GUILayout.Button("Load")) { lightmapData.Load(); } if (GUILayout.Button("Save")) { if (lightmapData.CheckResourcesDirectoryExists(lightmapData.resourceFolder)) { if (!EditorUtility.DisplayDialog("Overwrite Lightmap Resources?", "Lighmap Resources folder with name: \"" + lightmapData.resourceFolder + "\" already exists.\n\nPress OK to overwrite existing lightmap data.", "OK", "Cancel")) { return; } } else { if (!EditorUtility.DisplayDialog("Create Lightmap Resources?", "Create new lighmap Resources folder: \"" + lightmapData.resourceFolder + "?", "OK", "Cancel")) { return; } } lightmapData.SaveLightMaps(); } if (GUILayout.Button("Clear")) { lightmapData.Clear(); } }
private void Awake() { if (instance != null) { Destroy(gameObject); return; } else { instance = this; } if (loadOnAwake) { Load(); } }