예제 #1
0
        public static void CreateManager(MenuCommand command)
        {
            GameObject instance = new GameObject();

            instance.name = "SpeckleUnityManager";
            SpeckleUnityManager manager = instance.AddComponent <SpeckleUnityManager> ();

            manager.SetRenderingRule(Resources.Load <ColorByType> ("Color By Type"));

            GameObject currentSelection = (GameObject)command.context;

            // Child the new object to the currently selected object if there is one
            if (currentSelection != null)
            {
                instance.transform.parent = currentSelection.transform;
            }

            // Allow undoing the object creation with ctrl + z
            Undo.RegisterCreatedObjectUndo(instance, "Created " + instance.name);

            // Select the new object for the user
            Selection.activeObject = instance;
        }
예제 #2
0
 private void Awake()
 {
     manager.SetRenderingRule(rules[currentIndex]);
 }