Is this possible? Storing Custom arrays via OnInspectorGUI.

Hi All,

I’m trying to minimise my games load time by pre-calculating arrays that hold vector3 data.

What I’d like to do is have these arrays calculated then stored against gameobject via the gui.

Here’s some pseudo code:

public override void OnInspectorGUI()
{


[INDENT]target.myCalculationClass = target.Calculate();[/INDENT]


}

Now… Calculate() returns an array of this class:

public class MyCalculation {


[INDENT]Vector3[] data;[/INDENT]


}

So far I’m able to get all of this work in the edtior and I can verify that the data is being calculated and shown in the gui but when I load the game the target.myCalculationClass becomes null. Anyone got any ideas?

I’ve made a little progress… I can use an Array of Vector3’s but I cant have a multidimensional array or a custom class…

Still looking for the answer, feel free to let me know what it is :wink:

You have to mark your custom class with the System.Serializable attribute.

Thanks but I’ve tried adding the System.Serializable attribute but it doesn’t help. I’m guessing it might be a limitation since Vector3[,]'s don’t work either.

I’ve given up… i’ve gone ahead and created many variables vector0[ ], vector1[ ], vector2 etc then combined them on Start()

Not happy with the solution but it’s working as expected.