示例#1
0
        private void OnEnable()
        {
            string pathRoot = PathUtility.GetPackageRootPath();

            UnityObject icon = EditorGUIUtility.Load(Path.Combine(pathRoot,
                                                                  "Editor/VisualScripting.Shared/EditorAssetResources/SplitButtonArrow.png"));

            dropdownIcon = new GUIContent(icon as Texture2D);

            scrollArea = new Rect(0, 0, 630, 300);

            toggleOnScript    = false;
            toggleOnState     = false;
            shouldCloseWindow = false;

            var listOfOptions = new List <DropdownOptions>
            {
                new DropdownOptions
                {
                    label    = k_OnSelectedGameObject,
                    tooltip  = k_SelectedGameObject,
                    callback = CreateScriptGraphOnSelectedGameObject
                },
                new DropdownOptions
                {
                    label    = k_OnNewGameObject,
                    callback = CreateScriptGraphOnNewGameObject
                }
            };

            splitDropdownScriptGraph = new SplitDropdown(listOfOptions);

            listOfOptions = new List <DropdownOptions>
            {
                new DropdownOptions
                {
                    label    = k_OnSelectedGameObject,
                    tooltip  = k_SelectedGameObject,
                    callback = CreateStateGraphOnSelectedGameObject
                },
                new DropdownOptions
                {
                    label    = k_OnNewGameObject,
                    callback = CreateStateGraphOnNewGameObject
                }
            };

            splitDropdownStateGraph = new SplitDropdown(listOfOptions);
        }
        private void OnEnable()
        {
            string pathRoot = PathUtility.GetPackageRootPath();

            Object icon = EditorGUIUtility.Load(Path.Combine(pathRoot,
                                                             "Editor/VisualScripting.Welcome/EditorAssetResources/SplitButtonArrow.png"));

            dropdownIcon = new GUIContent(icon as Texture2D);

            scrollArea = new Rect(0, 0, 630, 300);

            toggleOnScript    = false;
            toggleOnState     = false;
            shouldCloseWindow = false;

            List <DropdownOptions> listOfOptions = new List <DropdownOptions>();

            listOfOptions.Add(new DropdownOptions()
            {
                label    = "...on selected game object",
                tooltip  = "Please, select a gameObject",
                callback = CreateScriptGraphOnSelectedGameObject
            });
            listOfOptions.Add(new DropdownOptions()
            {
                label = "...on new game object", callback = CreateScriptGraphOnNewGameObject
            });

            splitDropdownScriptGraph = new SplitDropdown(listOfOptions);

            listOfOptions = new List <DropdownOptions>();
            listOfOptions.Add(new DropdownOptions()
            {
                label    = "...on selected game object",
                tooltip  = "Please, select a gameObject",
                callback = CreateStateGraphOnSelectedGameObject
            });
            listOfOptions.Add(new DropdownOptions()
            {
                label = "...on new game object", callback = CreateStateGraphOnNewGameObject
            });

            splitDropdownStateGraph = new SplitDropdown(listOfOptions);
        }