/// <summary> /// Clears all UITexture.mainTexture in TexSetter /// </summary> /// <returns><c>true</c>, if scene is changed, <c>false</c> otherwise.</returns> public static void ClearAllTextures() { foreach (var o in EditorSceneManager.GetActiveScene().GetRootGameObjects()) { Transform root = o.transform; foreach (TexSetter s in root.GetComponentsInChildren <TexSetter>(true)) { TexLoaderBuildProcessor.ClearTexture(s.GetLoader()); } } }
public override void OnInspectorGUI() { DrawDefaultInspector(); if (loader.Target != null) { EditorGUILayout.BeginHorizontal(); if (loader.Target.mainTexture == null) { if (GUILayout.Button("Set")) { setter.SetTexture(texIndex); } texIndex = EditorGUILayout.IntField(texIndex, GUILayout.Width(50)); } else { if (GUILayout.Button("Clear")) { TexLoaderBuildProcessor.ClearTexture(setter.GetLoader()); } if (GUILayout.Button("Set Next")) { SetNext(); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Set All")) { SetAllTextures(); } if (GUILayout.Button("Next All")) { SetAllNext(); } if (GUILayout.Button("Clear All")) { ClearAllTextures(); } EditorGUILayout.EndHorizontal(); }