public static QObjectList getObjectList(bool createIfNotExist = true) { if (objectList == null) { QObjectList[] objectListArray = (QObjectList[])GameObject.FindObjectsOfType <QObjectList>(); for (int i = 0; i < objectListArray.Length; i++) { if (objectListArray[i].name == ObjectListName) { if (objectList == null) { objectList = objectListArray[i]; } else { objectList.merge(objectListArray[i]); GameObject.DestroyImmediate(objectListArray[i].gameObject); } } } if (objectList == null && createIfNotExist) { GameObject gameObjectList = new GameObject(); gameObjectList.name = ObjectListName; gameObjectList.tag = "EditorOnly"; objectList = gameObjectList.AddComponent <QObjectList>(); } } return(objectList); }
public static QObjectList getObjectList(bool createIfNotExist = true) { if (objectList == null) { QObjectList[] objectListArray = (QObjectList[])GameObject.FindObjectsOfType <QObjectList>(); for (int i = 0; i < objectListArray.Length; i++) { if (objectListArray[i].name == ObjectListName) { if (objectList == null) { objectList = objectListArray[i]; } else { objectList.merge(objectListArray[i]); GameObject.DestroyImmediate(objectListArray[i].gameObject); } } } if (objectList == null && createIfNotExist) { GameObject gameObjectList = new GameObject(); gameObjectList.name = ObjectListName; gameObjectList.tag = "EditorOnly"; objectList = gameObjectList.AddComponent <QObjectList>(); } if (objectList != null) { List <GameObject> wireframeHiddenObjects = objectList.wireframeHiddenObjects; foreach (GameObject gameObject in wireframeHiddenObjects) { Renderer renderer = gameObject.GetComponent <Renderer>(); if (renderer != null) { EditorUtility.SetSelectedWireframeHidden(renderer, true); } } } } return(objectList); }