Beispiel #1
0
        public static void AddGameObjectToScene(this IRTE editor, GameObject go)
        {
            Vector3     pivot      = Vector3.zero;
            IScenePivot scenePivot = editor.GetScenePivot();

            if (scenePivot != null)
            {
                pivot = scenePivot.SecondaryPivot;
            }
            go.transform.position = pivot;
            go.AddComponent <ExposeToEditor>();
            go.SetActive(true);
            editor.RegisterCreatedObjects(new[] { go });
        }
        public static void AddGameObjectToScene(this IRTE editor, GameObject go)
        {
            Vector3 pivot = Vector3.zero;
            IRuntimeSelectionComponent selectionComponent = editor.GetScenePivot();

            if (selectionComponent != null)
            {
                pivot = selectionComponent.SecondaryPivot;
            }

            editor.AddGameObjectToHierarchy(go);

            go.transform.position = pivot;
            go.AddComponent <ExposeToEditor>();
            go.SetActive(true);
            editor.RegisterCreatedObjects(new[] { go }, selectionComponent != null ? selectionComponent.CanSelect : true);
        }
Beispiel #3
0
        public void Destroy()
        {
            GameObject go = m_editor.Selection.activeGameObject;

            GameObject copy = Instantiate(go);

            copy.name = go.name;

            Deformer deformer = copy.GetComponent <Deformer>();

            Destroy(deformer);

            m_editor.Undo.BeginRecord();
            m_editor.RegisterCreatedObjects(new[] { copy }, true);
            m_editor.Delete(new[] { go });
            m_editor.Undo.EndRecord();
        }