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); 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); } }