Complex Arrays in Editor

I would like to build an array for a script much like the Input Manager list (what I mean by this is a list of compound values). I imagined this to be possible by creating an array of a struct.
Of course this works in the code and I can access the array values through code, but I would like it to be visible in the editor so the user could drag’n’drop stuff. Is there any way to obtain this behavior or is this a limitation?

Thanks in advance

Nevermind…

After thinking about it I thought of “serialization” and voilá, there was my answer…

If anyone else may happen to find this thread, the answer is using [Serializable].

Example:

Using UnityEngine;
Using System;
Using System.Collections.Generic;

[Serializable]
public class MyData
{
   public int myvar1;
   public int myvar2;
}

public class MyScriptClass
{
   public List<MyData> myData;
}
1 Like