I’m having a hard time with ISerialization process. Related to my post on the forum, I built a simple example to reproduce my problem.
Steps to reproduce:
- Create a script TestSerializer.cs anywhere on your project
- Assign script to an Empty GameObject
- Press play
Console output:
Serialization Test: myTest (12.0, 12.0, 12.0) (12, 12, 12) Serialization Vec3: (12, 12, 12) Deserialization Test: myTest (0.0, 0.0, 0.0) (0 0, 0, 0) Deserialization Vec3: (12, 12, 12) Result: myTest (0.0, 0.0, 0.0) (12, 12, 12)
Should have outputted:
Serialization Test: myTest (12.0, 12.0, 12.0) (12, 12, 12) Serialization Vec3: (12, 12, 12) Deserialization Vec3: (12, 12, 12) Deserialization Test: myTest (12.0, 12.0, 12.0) (12, 12, 12) Result: myTest (12.0, 12.0, 12.0) (12, 12, 12)
Problem:
I do understand that this process seems to be asynchronous since my t.vec3 is modified internally to the correct value at a different time. But since I’m converting Vec3 to Vector3 before that internal magic happen, my Vector3 is always (0,0,0).
To me, deserialization process seems to be reversed: Vec3 should be deserialized before Test. So I must did something wrong?