Ejemplo n.º 1
0
    void OnEnable()
    {
        SceneView.onSceneGUIDelegate += OnSceneGUI;

        spawnPattern = (PolygonSpawnPattern)target;
        if (spawnPattern.poly == null)
        {
            spawnPattern.poly = new Polygon();
        }

        spawableObjectsList = new ReorderableList(
            serializedObject,
            serializedObject.FindProperty("spawnableObjects"),
            true,
            true,
            true,
            true
            );

        spawableObjectsList.drawElementCallback =
            (Rect rect, int index, bool isActive, bool isFocused) =>
        {
            var element = spawableObjectsList.serializedProperty.GetArrayElementAtIndex(index);

            rect.y += 2;
            EditorGUI.PropertyField(
                new Rect(rect.x, rect.y, 250, EditorGUIUtility.singleLineHeight),
                element,
                GUIContent.none
                );
        };
        spawableObjectsList.drawHeaderCallback =
            (Rect rect) =>
        {
            EditorGUI.LabelField(
                rect,
                "Spawnable objects (must have a PolygonBehaviour)"
                );
        };
        //new the uninitialized vas
    }