0

I was making my own custom script editor with SerializedProperty variables, but I got the following error:

type is not a supported int value
UnityEditor.SerializedProperty:get_boolValue()

The reason why I was using SerializedProperty variable types is that I use the script on a prefab, which would cause some trouble with overriding parameters.

Here is my editor script:

using UnityEditor;
using UnityEngine;
using sp = UnityEditor.SerializedProperty;

[CustomEditor (typeof (ScriptName))]
public class SwitchableObjectEditor : Editor {

    SerializedProperty usePanel, morningHint;

    protected virtual void OnEnable () {
        usePanel = serializedObject.FindProperty ("morningHint");
        morningHint = serializedObject.FindProperty ("morningHint");
    }

    public override void OnInspectorGUI () {
        if (UnityEditor.EditorApplication.isPlaying)
            return;
        ScriptName s = (ScriptName) target;

        usePanel.boolValue = EditorGUILayout.Toggle (usePanel.boolValue);
        morningHint.stringValue = EditorGUILayout.TextArea (morningHint.stringValue);
        this.serializedObject.ApplyModifiedProperties ();
    }
}

I was frustrated, because the morningHint variable worked nicely.

1 Answer 1

1

It turns out I forgot to change the serializedObject.FindProperty() value for usePanel, changing it fixed everything.

Just putting this here in case anyone produced the same mistake.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.