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