Hi,
I am probably doing something the way it wasn’t designed for, but bear with me
Considering a case in which:
- I have a MonoBehaviour that has a reference to a single GraphNode (custom subclass of LevelGridNode marked with a
Serializable
attribute). - The field is marked with the
SerializeField
attribute. - I Instantiate (clone) the original object and after accessing the Node’s position of this cloned object it returns 0,0,0 as the Int3 isn’t marked as
Serializable
.
It would be awesome if I could do something like the above. Is there a reason why I cannot? Are there any workarounds?
EDIT:
I have now worked around this by implementing ISerializationCallbackReceiver and storing/restoring the position manually myself, but it seems like a terrible hack. I still would like to know what is the recommended way.