C# Unity自定义编辑器错误“;类型不是受支持的int值;

C# Unity自定义编辑器错误“;类型不是受支持的int值;,c#,unity3d,C#,Unity3d,我正在使用SerializedProperty变量制作自己的自定义脚本编辑器,但出现以下错误: type is not a supported int value UnityEditor.SerializedProperty:get_boolValue() 我之所以使用SerializedProperty变量类型,是因为我在预置上使用了脚本,这会导致重写参数时出现一些问题 以下是我的编辑器脚本: 使用UnityEditor; 使用UnityEngine; 使用sp=UnityEditor.Se

我正在使用
SerializedProperty
变量制作自己的自定义脚本编辑器,但出现以下错误:

type is not a supported int value
UnityEditor.SerializedProperty:get_boolValue()
我之所以使用
SerializedProperty
变量类型,是因为我在预置上使用了脚本,这会导致重写参数时出现一些问题

以下是我的编辑器脚本:

使用UnityEditor;
使用UnityEngine;
使用sp=UnityEditor.SerializedProperty;
[CustomEditor(typeof(ScriptName))]
公共类SwitchableObjectEditor:编辑器{
序列化属性使用面板,晨光提示;
受保护的虚拟void唯一性(){
usePanel=serializedObject.FindProperty(“晨光提示”);
morningHint=serializedObject.FindProperty(“morningHint”);
}
InspectorGUI()上的公共覆盖无效{
if(UnityEditor.EditorApplication.isplay)
返回;
ScriptName s=(ScriptName)目标;
usePanel.boolValue=EditorGUILayout.Toggle(usePanel.boolValue);
morningHint.stringValue=EditorGUILayout.TextArea(morningHint.stringValue);
this.serializedObject.ApplyModifiedProperties();
}
}

我很沮丧,因为morningHint变量工作得很好。

结果是我忘记更改usePanel的
serializedObject.FindProperty()
值,更改它修复了所有问题

把这个放在这里,以防有人犯同样的错误