This may have been a daydream but I thought I saw a way to make arrays of custom classes editiable in the inspectors.
I have a class “thingy” which I have an array of in a monobehavior. I can add or change "thingy"s but I would like to be able to edit "thinghy"s like you can edit the attributes of a Vector3 when in an array.
I know I can do this with custom editor windows but was wondering if the is a method I can add to my “thingy” class that the Inspector will use.
public class MyScript: MonoBehaviour {
// initializes in Inspector with 1 default element
public MyCustom[] custom = new MyCustom[1];
}
[Serializable, SerializePrivateVariables,StructLayout(LayoutKind.Sequential)]
public class MyCustom {
public Material material;
public Transform transform;
public Texture2D texture;
public MyCustom() {
texture = new Texture2D();
transform = new Transform();
material = new Material("");
}
public MyCustom(MyCustom other) {
material = other.material;
transform = other.transform;
material = other.material;
}
}