- Home /
Storing References of Custom Classes
I'm wondering how it would be possible that one could have a class such as the example one below:
public class Parent {
public Parent[] children = new Parent[4];
}
as a serializable class but have the children array elements only be references to other "Parent" instances in a script in a separate GameObject (this way I won't get [I'm hoping] serialization has too many depth levels error). I understand this is basically what pointers do but how can I mimic that functionality in Unity? The built-in classes do it such as GameObject as in you can have an array of gameObject's without storing the gameObject itself in the array, but when you want to alter it, it will alter the original. Is this doable in the manner I described above?
PS: I have read up a bit on serialization in Unity and pointers in Unity but the presented info was unclear.