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; }
private void Awake() { manager.SetRenderingRule(rules[currentIndex]); }