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

Unity3D/Problems 2013. 9. 1. 20:14
반응형

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





using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;

public class TestEditor : EditorWindow {

    private List<string> list = new List<string>();

    [MenuItem("Test/FoldItem")]
    static void Init(){
        EditorWindow window = EditorWindow.GetWindow(typeof(TestEditor));
        window.Show();
    }

    void OnGUI(){
        EventType type = Event.current.type;
        if( type == EventType.DragUpdated ){
            DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
        }
        if( type == EventType.DragPerform ){
            for(int i = 0; i<DragAndDrop.objectReferences.Length; i++){
                Debug.Log(DragAndDrop.objectReferences[i]);
                GUILayout.BeginArea(new Rect(0, 0, position.width, position.height));
                if( DragAndDrop.objectReferences.Length > 0) {
                    Debug.Log("-> " + DragAndDrop.objectReferences[0].name);
                    GUILayout.Label("test");
                }
                GUILayout.EndArea();
            }
        }
    }
}

반응형
: