ArgumentException: Getting control 1's position in a group with only 1 controls when doing

Unity3D 2013. 9. 12. 11:54
반응형

ArgumentException: Getting control 1's position in a group with only 1 controls when doing DragPerform

 

 

using UnityEngine;
using System.Collections;
using UnityEditor;

public class AnimationCheckEditorWindow : EditorWindow {

    private ArrayList _selectedList = new ArrayList();
    private bool _dragPerform = false;

    void OnEnable(){
        Debug.Log(this + " Enable");
    }

    void OnDisable(){
        Debug.Log(this + " Disable");
    }

    void OnDestory(){
        Debug.Log(this + " Destory");
    }

    void OnDidOpenScene(){
        Debug.Log(this + " OnDidOpenScene");
    }

    void OnFocus(){
        Debug.Log(this + " OnFocus");
    }

    void OnGUI(){

        GUILayout.Label("AnimationList");
        Debug.Log(this + " OnGUI\t" + Event.current + "\t" + Event.current.type);
        switch(Event.current.type){
            case EventType.DragUpdated:
                DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
            break;

            case EventType.DragPerform:
//                this._dragPerform = true;
                foreach( Object obj in DragAndDrop.objectReferences){
                    _selectedList.Add(obj.name);
                }
            break;

            case EventType.Layout:
                
            break;
        }

        foreach(string name in _selectedList){
            GUILayout.Label(name);
        }
    }

    void OnHierarchyChange(){
        Debug.Log(this + " OnHierarchyChange");
    }

    void OnInspectorUpdate(){
        Debug.Log(this + " OnInspectorUpdate");
    }

    void OnLostFocus(){
        Debug.Log(this + " OnLostFocus");
    }

    void OnProjectChange(){
        Debug.Log(this + " OnLostFocus");
    }

    void OnSelectionChange(){
        Debug.Log(this + " OnSelectionChange\t" + Selection.objects.Length);
    }

    void Update(){
        Debug.Log(this + " Update");
//        if( this._dragPerform ){
//            this._dragPerform = false;
//        }
    }
}

 

 

 

 

 

 

 

 

using UnityEngine;
using System.Collections;
using UnityEditor;

public class AnimationCheckEditorWindow : EditorWindow {

    private ArrayList _selectedList = new ArrayList();
    private bool _dragPerform = false;

    void OnEnable(){
        Debug.Log(this + " Enable");
    }

    void OnDisable(){
        Debug.Log(this + " Disable");
    }

    void OnDestory(){
        Debug.Log(this + " Destory");
    }

    void OnDidOpenScene(){
        Debug.Log(this + " OnDidOpenScene");
    }

    void OnFocus(){
        Debug.Log(this + " OnFocus");
    }

    void OnGUI(){

        GUILayout.Label("AnimationList");
        Debug.Log(this + " OnGUI\t" + Event.current + "\t" + Event.current.type);
        switch(Event.current.type){
            case EventType.DragUpdated:
                DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
            break;

            case EventType.DragPerform:
                this._dragPerform = true;
            break;

            case EventType.Layout:
                
            break;
        }

        foreach(string name in _selectedList){
            GUILayout.Label(name);
        }



    }

    void OnHierarchyChange(){
        Debug.Log(this + " OnHierarchyChange");
    }

    void OnInspectorUpdate(){
        Debug.Log(this + " OnInspectorUpdate");
    }

    void OnLostFocus(){
        Debug.Log(this + " OnLostFocus");
    }

    void OnProjectChange(){
        Debug.Log(this + " OnLostFocus");
    }

    void OnSelectionChange(){
        Debug.Log(this + " OnSelectionChange\t" + Selection.objects.Length);
    }

    void Update(){
        Debug.Log(this + " Update");
        if( this._dragPerform ){
            this._dragPerform = false;
            foreach( Object obj in DragAndDrop.objectReferences){
                _selectedList.Add(obj.name);
            }
        }

    }
}

 

 


반응형

'Unity3D' 카테고리의 다른 글

Unity3d 새로운 GUI시스템  (0) 2013.09.22
Unity3d 4.3 2D Workflow  (0) 2013.09.22
EditorWindow  (0) 2013.09.12
Gizmo and Icon Display Controls  (0) 2013.09.06
How do I use layermasks?  (0) 2013.09.06
: