void Find() { var allObjects = SceneObjectUtility.GetAllObjectsInScene(false); layerWithObjectList.Clear(); int defaultLayer = LayerMask.NameToLayer("Default"); foreach (var obj in allObjects) { if (obj.layer == defaultLayer) { continue; } var layerWithObj = layerWithObjectList.Find((item) => item.layer == obj.layer); if (layerWithObj == null) { layerWithObj = new LayerWithObject() { layer = obj.layer }; layerWithObjectList.Add(layerWithObj); } layerWithObj.objectList.Add(obj); } }
void Find() { var allObjects = SceneObjectUtility.GetAllObjectsInScene(false); tagWithObjectList.Clear(); foreach (var obj in allObjects) { if (obj.CompareTag("Untagged")) { continue; } var tagWithObj = tagWithObjectList.Find((item) => item.tag == obj.tag); if (tagWithObj == null) { tagWithObj = new TagWithObjects() { tag = obj.tag }; tagWithObjectList.Add(tagWithObj); } tagWithObj.objectList.Add(obj); } }
/* * void OnSelectionChange () * // void Update() * { * * if (EditorApplication.isPaused || !EditorApplication.isPlaying) { * UpdateAllObject (); * UpdateList (); * } * } */ void UpdateAllObject() { allObject = SceneObjectUtility.GetAllObjectsInScene(false); }