private GameObject CreateToolsPanel()
        {
            ToolsExamplePanelFactory factory = Undoable.AddComponent <ToolsExamplePanelFactory>(disposable);

            factory.parent        = parent;
            factory.fileOpen      = fileOpen;
            factory.fileSaveAs    = fileSaveAs;
            factory.skyboxManager = skyboxManager;
            GameObject panel = factory.Generate();

            toolsInstance = panel;
            Vector3 localPosition = toolsInstance.transform.localPosition;

            localPosition.x = toolsLocalPosition.x;
            toolsInstance.transform.localPosition = localPosition;

#if UNITY_EDITOR
            var touchPadButtons = touchPadMenuController.touchPadButtons;
            for (int i = 0; i < touchPadButtons[0].onSelected.GetPersistentEventCount(); i++)
            {
                UnityEventTools.RemovePersistentListener(touchPadButtons[0].onSelected, 0);
            }
            UnityEventTools.AddPersistentListener(touchPadButtons[0].onSelected, toolsInstance.GetComponent <StandardPanel>().ToggleVisible);
            touchPadMenuController.touchPadButtons = touchPadButtons;
#endif

            return(panel);
        }
예제 #2
0
 protected override void BuildGenerateButton()
 {
     // Take out this if statement to set the value using setter when ever you change it in the inspector.
     // But then it gets called a couple of times when ever inspector updates
     // By having a button, you can control when the value goes through the setter and getter, your self.
     if (GUILayout.Button("Generate"))
     {
         if (target.GetType() == typeof(ToolsExamplePanelFactory))
         {
             ToolsExamplePanelFactory factory = (ToolsExamplePanelFactory)target;
             factory.Generate();
         }
     }
 }