/// <summary> /// Добавить компонент EditorCollider в указанные объекты /// </summary> void CreateColliders() { EditorColliderCreator creator = (EditorColliderCreator)target; foreach (GameObject editorObj in creator.editorObjects) { if (editorObj.GetComponent <EditorCollider>() == null) { editorObj.AddComponent <EditorCollider>(); } } }
/// <summary> /// Убратьь компонент EditorCollider из указанных объектов /// </summary> void RemoveColliders() { EditorColliderCreator creator = (EditorColliderCreator)target; EditorCollider col = null; foreach (GameObject editorObj in creator.editorObjects) { if ((col = editorObj.GetComponent <EditorCollider>()) != null) { DestroyImmediate(col); } } }