// Draw the property inside the given rect
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        //don't alter
        EditorGUI.BeginProperty(position, label, property);
        position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
        var indent = EditorGUI.indentLevel;

        EditorGUI.indentLevel = 0;

        float startY = position.y;

        //show the result type selection
        EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, position.height), property.FindPropertyRelative("resultType"), GUIContent.none, true);

        position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("resultType"), GUIContent.none, true);

        //dependent on selection
        EventScript.resultTypes res = (EventScript.resultTypes)property.FindPropertyRelative("resultType").enumValueIndex;
        if (res == EventScript.resultTypes.simple)
        {
            EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("modifiers"), true);
            position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiers"), GUIContent.none, true);
        }
        else if (res == EventScript.resultTypes.conditional || res == EventScript.resultTypes.randomConditions)
        {
            EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("conditions"), true);
            position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("conditions"), GUIContent.none, true);

            EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("modifiersTrue"), true);
            position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersTrue"), GUIContent.none, true);

            EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("modifiersFalse"), true);
            position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersFalse"), GUIContent.none, true);
        }
        else if (res == EventScript.resultTypes.random)
        {
            EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("randomModifiers"), true);
            position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("randomModifiers"), GUIContent.none, true);
        }

        //draw the events
        //EditorGUI.PropertyField (new Rect (50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative ("OnSwipe"), true);
        //position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative ("OnSwipe"),GUIContent.none ,true);

        mySize = position.y - startY;

        //don't alter
        EditorGUI.indentLevel = indent;
        EditorGUI.EndProperty();
    }
    float getSize(SerializedProperty property)
    {
        mySize = 0f;

        mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("resultType"), GUIContent.none, true);
        //dependent on selection
        EventScript.resultTypes res = (EventScript.resultTypes)property.FindPropertyRelative("resultType").enumValueIndex;
        if (res == EventScript.resultTypes.simple)
        {
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiers"), GUIContent.none, true);
        }
        else if (res == EventScript.resultTypes.conditional || res == EventScript.resultTypes.randomConditions)
        {
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("conditions"), GUIContent.none, true);
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersTrue"), GUIContent.none, true);
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersFalse"), GUIContent.none, true);
        }
        else if (res == EventScript.resultTypes.random)
        {
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("randomModifiers"), GUIContent.none, true);
        }

        //show property depending on configuration

        Object parentO = property.serializedObject.targetObject;

        if (parentO.GetType() == typeof(EventScript))
        {
            EventScript parent = (EventScript)property.serializedObject.targetObject;

            if ((property.name == "additional_choice_0" || property.name == "additional_choice_1") && parent.additionalChoices == false)
            {
                mySize = 0f;
            }
            if ((property.name == "resultUp" || property.name == "resultDown") && parent.swipeType == EventScript.E_SwipeType.LeftRight)
            {
                mySize = 0f;
            }
        }

        return(mySize);
    }
    float getSize(SerializedProperty property)
    {
        mySize = 0f;

        mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("resultType"), GUIContent.none, true);
        //dependent on selection
        EventScript.resultTypes res = (EventScript.resultTypes)property.FindPropertyRelative("resultType").enumValueIndex;
        if (res == EventScript.resultTypes.simple)
        {
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiers"), GUIContent.none, true);
        }
        else if (res == EventScript.resultTypes.conditional || res == EventScript.resultTypes.randomConditions)
        {
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("conditions"), GUIContent.none, true);
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersTrue"), GUIContent.none, true);
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersFalse"), GUIContent.none, true);
        }
        else if (res == EventScript.resultTypes.random)
        {
            mySize += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("randomModifiers"), GUIContent.none, true);
        }
        return(mySize);
    }
    // Draw the property inside the given rect
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        //show property depending on configuration
        Object parentO = property.serializedObject.targetObject;
        bool   show    = true;

        if (parentO.GetType() == typeof(EventScript))
        {
            EventScript parent = (EventScript)parentO;
            if ((property.name == "additional_choice_0" || property.name == "additional_choice_1") && parent.additionalChoices == false)
            {
                show = false;
            }
            if ((property.name == "resultUp" || property.name == "resultDown") && parent.swipeType == EventScript.E_SwipeType.LeftRight)
            {
                show = false;
            }
        }

        if (show)
        {
            //don't alter
            EditorGUI.BeginProperty(position, label, property);
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
            var indent = EditorGUI.indentLevel;
            EditorGUI.indentLevel = 0;

            float startY = position.y;

            //show the result type selection
            EditorGUI.PropertyField(new Rect(position.x, position.y, position.width, position.height), property.FindPropertyRelative("resultType"), GUIContent.none, true);

            position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("resultType"), GUIContent.none, true);

            //dependent on selection
            EventScript.resultTypes res = (EventScript.resultTypes)property.FindPropertyRelative("resultType").enumValueIndex;
            if (res == EventScript.resultTypes.simple)
            {
                EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("modifiers"), true);
                position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiers"), GUIContent.none, true);
            }
            else if (res == EventScript.resultTypes.conditional || res == EventScript.resultTypes.randomConditions)
            {
                EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("conditions"), true);
                position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("conditions"), GUIContent.none, true);

                EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("modifiersTrue"), true);
                position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersTrue"), GUIContent.none, true);

                EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("modifiersFalse"), true);
                position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("modifiersFalse"), GUIContent.none, true);
            }
            else if (res == EventScript.resultTypes.random)
            {
                EditorGUI.PropertyField(new Rect(50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative("randomModifiers"), true);
                position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("randomModifiers"), GUIContent.none, true);
            }

            //draw the events
            //EditorGUI.PropertyField (new Rect (50, position.y, position.x + position.width - 50, position.height), property.FindPropertyRelative ("OnSwipe"), true);
            //position.y += EditorGUI.GetPropertyHeight(property.FindPropertyRelative ("OnSwipe"),GUIContent.none ,true);

            mySize = position.y - startY;

            //don't alter
            EditorGUI.indentLevel = indent;
            EditorGUI.EndProperty();
        }
        else
        {
            //EditorGUI.LabelField(new Rect(position.x, position.y, position.width, position.height), "");
        }
    }