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