void OnGUI() { List <List <GameObject> > getAllOnProj = AllObjectProject; List <List <GameObject> > getAllOnScene = AllObjectScene; List <List <GameObject> > getAllOnPrefab = InfoOnPrefab; List <int> bProj = bPageProj; List <int> bScene = bPageScene; List <int> bPref = bPagePref; List <bool> fPref = foldoutPref; List <bool> fScene = foldoutScene; List <bool> fProj = foldoutProj; int a; GUILayout.Label("Get Specific object", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck( ); thisType = (ResearcheType)EditorGUILayout.EnumPopup("Research Type:", thisType); if (EditorGUI.EndChangeCheck( )) { AllObjectScene = new List <List <GameObject> > ( ); AllObjectProject = new List <List <GameObject> > ( ); InfoOnPrefab = new List <List <GameObject> > ( ); objComp = null; thisStringSearch = string.Empty; thisNbr = 0; compDiff = 2; apply = false; } switch (thisType) { case ResearcheType.Tag: thisStringSearch = EditorGUILayout.TagField("Search This Tag :", thisStringSearch); break; case ResearcheType.Layer: thisNbr = EditorGUILayout.LayerField("Search This Number Layer :", thisNbr); thisStringSearch = thisNbr.ToString( ); break; case ResearcheType.Name: thisStringSearch = EditorGUILayout.TextField("Search This Name :", thisStringSearch); break; case ResearcheType.Component: objComp = EditorGUILayout.ObjectField("This component", objComp, typeof(Object), true); break; case ResearcheType.SamePref: EditorGUILayout.BeginVertical( ); EditorGUI.BeginChangeCheck( ); objComp = EditorGUILayout.ObjectField("This Object", objComp, typeof(Object), true); if (EditorGUI.EndChangeCheck( )) { apply = false; CompInfo = new List <Component> ( ); if (objComp != null) { GameObject getObj = ( GameObject )objComp; foreach (Component thisComp in getObj.GetComponents <Component> ( )) { CompInfo.Add(thisComp); } } } compDiff = (int)EditorGUILayout.Slider("Max Number Component Different", compDiff, 0, 10); EditorGUILayout.EndVertical( ); break; } var buttonStyle = new GUIStyle(EditorStyles.miniButton); if (getChildren) { buttonStyle.normal.textColor = Color.green; } else { buttonStyle.normal.textColor = Color.red; } if (GUILayout.Button("Search On Children", buttonStyle)) { getChildren = !getChildren; } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Object On Scene")) { aPageScene = 0; bPageScene = new List <int> ( ); bScene = bPageScene; fScene = foldoutScene; childScene = getChildren; AllObjectScene = SearchObject.LoadAssetOnScenes(thisType, objComp, thisStringSearch, getChildren, compDiff); getAllOnScene = AllObjectScene; for (a = 0; a < getAllOnScene.Count; a++) { bScene.Add(0); fScene.Add(false); } } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Object On Object")) { bPageProj = new List <int> ( ); foldoutProj = new List <bool> ( ); fProj = foldoutProj; bProj = bPageProj; aPageProj = 0; childProj = getChildren; AllObjectProject = SearchObject.LoadAssetsInProject(thisType, objComp, thisStringSearch, getChildren, SpecificPath, compDiff); getAllOnProj = AllObjectProject; for (a = 0; a < getAllOnProj.Count; a++) { bProj.Add(0); fProj.Add(false); } } SpecificPath = EditorGUILayout.TextField("On Specific folder :", SpecificPath); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Object On Prefabs") && thispref != null) { aPagePref = 0; bPagePref = new List <int> ( ); bPref = bPagePref; fPref = foldoutPref; childPref = getChildren; InfoOnPrefab = SearchObject.LoadOnPrefab(thisType, objComp, thispref, thisStringSearch, getChildren, compDiff); getAllOnPrefab = InfoOnPrefab; for (a = 0; a < getAllOnPrefab.Count; a++) { bPref.Add(0); fPref.Add(false); } } var list = thispref; int newCount = Mathf.Max(0, EditorGUILayout.IntField("Number Ref", list.Count)); while (newCount < list.Count) { list.RemoveAt(list.Count - 1); } while (newCount > list.Count) { list.Add(null); } EditorGUILayout.BeginVertical( ); if (thispref.Count > 0) { foldListPref = EditorGUILayout.Foldout(foldListPref, "Object List"); } if (foldListPref) { for (a = 0; a < thispref.Count; a++) { thispref [a] = ( GameObject )EditorGUILayout.ObjectField("This component", thispref [a], typeof(GameObject), true); } } EditorGUILayout.EndVertical( ); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space( ); EditorGUILayout.Space( ); if (thisType == ResearcheType.SamePref) { if (apply) { EditorGUILayout.BeginHorizontal( ); if (GUILayout.Button("Confirm", EditorStyles.miniButton)) { modifPref(getAllOnScene); modifPref(getAllOnProj); modifPref(getAllOnPrefab); apply = false; } if (GUILayout.Button("Cancel", EditorStyles.miniButton)) { apply = false; } EditorGUILayout.EndHorizontal( ); } else { EditorGUILayout.BeginHorizontal( ); if ((getAllOnScene.Count > 0 || getAllOnProj.Count > 0 || getAllOnPrefab.Count > 0) && CompInfo.Count > 0 && GUILayout.Button("Apply Update", EditorStyles.miniButton)) { apply = true; } EditorGUILayout.BeginVertical( ); EditorGUI.indentLevel = 2; if (CompInfo.Count > 0) { foldComp = EditorGUILayout.Foldout(foldComp, "Component List"); } if (foldComp) { for (a = 0; a < CompInfo.Count; a++) { EditorGUILayout.BeginHorizontal( ); EditorGUILayout.PrefixLabel(CompInfo [a].GetType( ).ToString( )); if (GUILayout.Button("Remove From Update", EditorStyles.miniButton)) { CompInfo.RemoveAt(a); a--; } EditorGUILayout.EndHorizontal( ); } } EditorGUI.indentLevel = 0; EditorGUILayout.EndVertical( ); EditorGUILayout.EndHorizontal(); } } EditorGUILayout.BeginHorizontal( ); #region Scene Layout if (getAllOnScene.Count > 0) { scrollPosScene = EditorGUILayout.BeginScrollView(scrollPosScene); if (GUILayout.Button("Clear Scene", EditorStyles.miniButton)) { AllObjectScene = new List <List <GameObject> > ( ); } aPageScene = LayoutSearch(getAllOnScene, bScene, fScene, aPageScene, childScene); EditorGUILayout.EndScrollView( ); } #endregion #region Project layout if (getAllOnProj.Count > 0) { scrollPosProj = EditorGUILayout.BeginScrollView(scrollPosProj); if (GUILayout.Button("Clear Project", EditorStyles.miniButton)) { AllObjectProject = new List <List <GameObject> > ( ); } aPageProj = LayoutSearch(getAllOnProj, bProj, fProj, aPageProj, childProj); EditorGUILayout.EndScrollView( ); } #endregion #region Pref Layout if (getAllOnPrefab.Count > 0) { scrollPosPref = EditorGUILayout.BeginScrollView(scrollPosPref); if (GUILayout.Button("Clear Pref", EditorStyles.miniButton)) { InfoOnPrefab = new List <List <GameObject> > ( ); } aPagePref = LayoutSearch(getAllOnPrefab, bPref, fPref, aPagePref, childPref); EditorGUILayout.EndScrollView( ); } #endregion EditorGUILayout.EndHorizontal(); }