Problem is not reproducible or outdated
Custom Editor script - List<> problem
Hi guys,
I've been struggling with this for a couple of hours, but the Editor has me stumped.
I have a TutorialProcess class that I want to use to track progress through a Tutorial, with Button objects that trigger the completion of the Task.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[System.Serializable]
public class TutorialProcess : MonoBehaviour
{
public List<TutTasks> Pages = new List<TutTasks>();
[System.Serializable]
public class TutTasks
{
public string detail;
public bool completed;
public Button trigger;
public TutTasks(string Details)
{
detail = Details;
completed = false;
trigger = null;
}
}
void Start()
{
Pages.Add(new TutTasks("Welcome to the Tutorial"));
}
}
My TutorialProcessEditor is also very simple:
using UnityEditor;
[CustomEditor(typeof(TutorialProcess)), CanEditMultipleObjects]
public class TutorialProcessEditor : Editor
{
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(serializedObject.FindProperty("Pages"),true);
serializedObject.ApplyModifiedProperties();
}
}
As you can see from the below screenshot, the data is not populating. I need to edit the tutorial text, AND drag in a Button as a trigger. I know the list is created correctly, and the new task is added at Start(), but its not showing in the Editor? Can anybody assist with getting this to work properly?
If I could hide the "Element n" for each row too thatd be cool. :)
Thanks
Follow this Question
Related Questions
ScriptableObject not Serializing? 0 Answers
Joystick Orientation Wrong After Camera Rotation 1 Answer
Moving object alone y-axis 1 Answer