- Home /
Use fields of a normal class on FindProperty
Hello,
I've been trying to create a custom inspector for a class called EventSequence, a MonoBehaviour, containing a list of EventAction, which is a normal class.
It's supposed to create an event system similar to that of RPG Maker.
[CustomEditor(typeof(EventSequence))]
public class SomeEditor : Editor
{
SerializedProperty actions;
private void OnEnable()
{
actions = serializedObject.FindProperty("actions");
}
public override void OnInspectorGUI()
{
EventSequence sequence = target as EventSequence;
serializedObject.Update();
EditorGUILayout.IntField("Actions Size", sequence.actions.Capacity);
for (int i = 0; i < sequence.actions.Count; i++)
{
EditorGUILayout.PropertyField(actions.GetArrayElementAtIndex(i));
}
serializedObject.ApplyModifiedProperties();
}
}
This is the code for the EventSequence custom inspector. The property actions from the serializedObjects is a List.
The field of the size of the array works fine, but the fields for each EventAction don't show up. Any help?
Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220612195655im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How i can subscribe to an Event through Inspector 0 Answers
How do I make child classes in a list editable from the Inspector? 1 Answer
Unable to draw propertyfield in inspector for some classes, findProperty returns null. 0 Answers
Error when trying to Serialize a field that is in a class 0 Answers
Serializing list of base and derived classes with custom inspector 1 Answer