A 2d-array of TableMatrix is initialized after starting play mode.

Issue #460 resolved
Hoosang Yoo created an issue

I have a problem that a 2d-array of TableMatrix is initialized after starting play mode.

I use a code almost same as example on manual page. It works well if TableMatrix is a member of the class which is inherited from MonoBehavior. However, if TableMatrix is a member of the class which is not inherited from MonoBehavior, the issue is happened.

My code is below that code.jpg

And, in inspector, Table is shown as well. before.jpg

But after starting play mode, Table is initialized. after.jpg

Could you please help me what is the root cause of this problem and how to solve it?

Comments (3)

  1. Tor Esa Vestergaard

    An issue was introduced in 2.0.10 where members would be shown even despite not being serialized - this was fixed in 2.0.11. Can you install Odin 2.0.11, open the serialization debugger, and verify that your array is serialized by Odin? You may also find this FAQ answer helpful.

  2. Hoosang Yoo reporter

    OK, I found out that 2d-array is not serialized by Unity System. So I use [OdinSerialize] instead of [SerializedField] for mGrid (2d-array in AttackRange class). Also I changed the class which contains AttackRange to be inherited from SerializedMonoBehaviour instead of MonoBehaviour and use [OdinSerialize] too. This seems to solve the my problem.

  3. Log in to comment