JSON.stringfy breaking change Vector3

I was checking out the beta to see if my current app would need to be modified. I noticed one thing that was broken. In 4.1, JSON.stringify(<vector3>) would return {"x":0,"y":12,"z":32} however in the latest build it returns {"_isDirty":true,"_x":0,"_y":12,"_z":32}

Here is a playground so you don’t have to type it out.

Will this be the version going forward?

Yes, I think this change has been done to improve performances of Vector3 in some circonstances.

@Deltakosh will know better.

1 Like

We did that to be able to cache vector3 value so yes this is the going forward state :wink:

There is always Vector3.toString() but I dont know if that helps you.

It’s no problem, I just had to change how I read the value back in to use _x instead of x, it was just an unexpected issue when updating.

Thanks!

2 Likes

i would always use an array in such cases, [ xVal , yVal , zVal ] will never change :slight_smile:

1 Like

Yea, that’d be the best bet, to just serialize it myself as some interface, but since it just worked as is in the past, I left it alone.