public override void OnInspectorGUI() { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.labelWidth - (EditorGUI.indentLevel * 15.0f) + 11)); if (GUILayout.Button("Rebuild Scene", GUILayout.ExpandWidth(false))) { SceneIndexer indexer = target as SceneIndexer; indexer.CacheSceneObjects(); } } EditorGUILayout.EndHorizontal(); }
private static void UpdateSceneIndex(Scene scene) { //Find SceneIndexer and update its caches list SceneIndexer indexer = SceneUtils.FindInScene <SceneIndexer>(scene); //Create a new one if one doesn't exist if (indexer == null) { GameObject newObj = new GameObject("SceneIndexer"); EditorSceneManager.MoveGameObjectToScene(newObj, scene); indexer = newObj.AddComponent <SceneIndexer>(); } indexer.CacheSceneObjects(); //Hack, save string on save scene Localisation.SaveStrings(); }
private static void UpdateSceneIndex(Scene scene) { //Find SceneIndexer and update its caches list SceneIndexer indexer = SceneUtils.FindInScene <SceneIndexer>(scene); //Create a new one if one doesn't exist if (indexer == null) { GameObject gameObject = new GameObject("Scene Indexer", typeof(SceneIndexer)) { hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector | HideFlags.NotEditable }; SceneManager.MoveGameObjectToScene(gameObject, scene); indexer = gameObject.GetComponent <SceneIndexer>(); } indexer.CacheSceneObjects(); }