#pragma warning restore 649 public override bool CreateGameObject(out GameObject createdObj, Transform parentTransform) { if (m_Prefab == null) { createdObj = null; return(false); } MARSSession.EnsureRuntimeState(); var objName = GameObjectUtility.GetUniqueNameForSibling(null, m_ObjectName); createdObj = Instantiate(m_Prefab); MarsWorldScaleModule.ScaleChildren(createdObj.transform); foreach (var colorComponent in createdObj.GetComponentsInChildren <IHasEditorColor>()) { colorComponent.SetNewColor(true, true); } createdObj.name = objName; Undo.RegisterCreatedObjectUndo(createdObj, $"Create {objName}"); Selection.activeGameObject = createdObj; return(true); }
public override bool CreateGameObject() { if (m_Prefab == null) { return(false); } MARSSession.EnsureRuntimeState(); var objName = GameObjectUtility.GetUniqueNameForSibling(null, m_ButtonName); var go = Instantiate(m_Prefab); MarsWorldScaleModule.ScaleChildren(go.transform); foreach (var colorComponent in go.GetComponentsInChildren <IHasEditorColor>()) { colorComponent.SetNewColor(true, true); } go.name = objName; Undo.RegisterCreatedObjectUndo(go, $"Create {objName}"); Selection.activeGameObject = go; return(true); }