Exemplo n.º 1
0
        /// <summary>
        /// Example method on how to call the '<see cref="PaaloEditorHelper.DrawDragAndDropArea{T}(DragAndDropAreaInfo, System.Action{T[]})"/>'
        /// from OnGUI(), using a "dedicated" callback function.
        /// </summary>
        private void DrawDragAndDropArea_NormalMethod()
        {
            EditorGUILayout.LabelField("Normal Callback-method:", EditorStyles.boldLabel);

            //Using a "proper" function to handle the Callback
            PaaloEditorHelper.DrawDragAndDropArea <AudioClip>(
                new DragAndDropAreaInfo("AudioClips"),
                OnDragAndDropPerformed_CallbackExample);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Example method on how to call the '<see cref="PaaloEditorHelper.DrawDragAndDropArea{T}(DragAndDropAreaInfo, System.Action{T[]})"/>'
        /// from OnGUI() using a Lambda Expression to handle the dragged objects.
        /// </summary>
        private void DrawDragAndDropArea_LambdaExpression()
        {
            EditorGUILayout.LabelField("Lambda Expression-method:", EditorStyles.boldLabel);

            //Using a Lambda Expression for the Callback
            PaaloEditorHelper.DrawDragAndDropArea <AudioClip>(
                new DragAndDropAreaInfo("AudioClips"),
                draggedObjects =>
            {
                Debug.Log($"Dragged Objects Length: {draggedObjects.Length}");
                arrayObjects = draggedObjects;
            });
        }
        private void GUISection_SetAudioClips()
        {
            //Disable button if no gameobjects are selected.
            var  selectedObjects = Selection.gameObjects;
            bool enableGui       = selectedObjects.Length > 0 ? true : false;

            PaaloEditorHelper.ButtonDisableable("Disableable Button with no Extras", () => { Debug.Log("No Extras"); });

            PaaloEditorHelper.ButtonDisableable($"Selected '{selectedObjects.Length}' GameObjects, say 'Hej!'",
                                                () => { Debug.Log("Hej!"); },
                                                enableGui,
                                                null,
                                                false);
        }