I’m not sure this can be done at all, but here’s what I’m trying to do:
My component has several properties (public fields) which are editable in the Editor. One of those should be a list containing a specific class, and I’m trying to make this list, and especially the fields of the objects contained in that list editable in the Editor.
The component looks like this:
[Serializable]
public class DialogmenuControllerReponse {
public TextMeshProUGUI Icon;
public TextMeshProUGUI Text;
}
public class DialogMenuController : MonoBehaviour
{
// ...
[Expandable]
public List<DialogmenuControllerReponse> Responses;
}
However, if I leave it like that, I get the “type is not a supported pptr value” exception in the editor when I try to expand the fields in the editor. There’s also some GUI corruption:
except for the GUI corruption which makes the fields non-editable, and the exception, that’s pretty much exactly what I want - to create a list of a certain size and to edit the fields in its objects in the Editor.
If I derive the DialogmenuControllerReponse class (whose instances are in the list) from UnityEngine.Object or a ScriptableObject, the editor shows a list of None objects (pretty much null references, right?):
And I can’t seem to create those elements in-place. I’m NOT looking for a solution where I create ScriptableObjects in the file system and drag&drop them here. I’m looking for a way to edit the fields of those elements in the preceding images (which might involve creating those elements somehow in the first place).