private void UninitializeSingleton() { if (instance == this) { instance = null; } }
private void InitializeSingleton() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } }
private void DrawTools() { EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); EditorGUILayout.LabelField("Tools", EditorStyles.boldLabel); if (Application.isPlaying) { EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Search")) { LocationDatabase.Search(searchKeyword); } searchKeyword = EditorGUILayout.TextField(searchKeyword); if (GUILayout.Button("Clear")) { searchKeyword = ""; EditorGUILayout.TextField(searchKeyword); } EditorGUILayout.EndHorizontal(); } else { EditorGUILayout.LabelField("Paths"); EditorGUI.indentLevel++; pointsOfInterestPath = EditorGUILayout.TextField("Points of Interest", pointsOfInterestPath); placesPath = EditorGUILayout.TextField("Places", placesPath); roomsPath = EditorGUILayout.TextField("Rooms", roomsPath); EditorGUI.indentLevel--; if (GUILayout.Button("Load Places")) { locationDatabase.SetPointsOfInterestGroup(GetPlaces()); serializedObject.ApplyModifiedProperties(); serializedObject.Update(); } } if (EditorGUI.EndChangeCheck()) { SavePrefs(); } EditorGUILayout.Space(); }
private void OnEnable() { locationDatabase = target as LocationDatabase; pointsOfInterestProperty = serializedObject.FindProperty("pointsOfInterestGroup"); LoadPrefs(); }