nullable vector2 does not want to become a null

Issue #305 wontfix
Dmitry Savosh created an issue

I use nullable vector2 (Vector2?). When I set it to null, it becomes null, but in next Update it returns the last value. So, I cant set it to null. This behavior works as described only if I watching the value in the inpector. If i close inspector, everything works as it should.

Comments (5)

  1. mSkull001

    I'm unable to reproduce this issue. Doing this in Unity 2017.3.0f3 seems to work as expected:

    public class TestBehaviour : MonoBehaviour
    {
        [ShowInInspector]
        public Vector2? MyVector2;
    }
    

    If you could further detail how you've come to your problem, perhaps we can find a solution?

  2. Tor Esa Vestergaard

    Since the reporter states that they use default Unity serialization, Vector? is not supported, nor should it be - Unity does not support nullable serialization by default.

  3. Log in to comment