i have a structure like this:
[System.Serializable]
public struct partData
{
public Vector3[] vertices;
public int[] triangles;
public Matrix4x4 worldMatrix;
public List<Vector2> uvs;
}
if i try to populate it the matrix is all 0’s, so i boiled it down to this:
JsonUtility.FromJson<partData>("{\"worldMatrix\":{\"m00\":4.641731886634304e-7,\"m10\":-1.5472438025243562e-7,\"m20\":0.9999996905511916,\"m30\":0,\"m01\":0.9999996905511916,\"m11\":4.641731886634304e-7,\"m21\":-1.5472438025243562e-7,\"m31\":0,\"m02\":-1.5472438025243562e-7,\"m12\":0.9999996905511916,\"m22\":4.641731886634304e-7,\"m32\":0,\"m03\":0.0000030839724787234957,\"m13\":-16.875003990971535,\"m23\":-0.0000039840041483607536,\"m33\":1}}")
which also fails the same way. if i run this:
JsonUtility.FromJson<Matrix4x4>("{\"m00\":4.641731886634304e-7,\"m10\":-1.5472438025243562e-7,\"m20\":0.9999996905511916,\"m30\":0,\"m01\":0.9999996905511916,\"m11\":4.641731886634304e-7,\"m21\":-1.5472438025243562e-7,\"m31\":0,\"m02\":-1.5472438025243562e-7,\"m12\":0.9999996905511916,\"m22\":4.641731886634304e-7,\"m32\":0,\"m03\":0.0000030839724787234957,\"m13\":-16.875003990971535,\"m23\":-0.0000039840041483607536,\"m33\":1}")
it load the matrix correctly but as part of another structure it does not, any idea on why this might be and what i can do.
in the short term i can calculate the vector points using the matrix on the data source before sending it to unity, but this is suboptimal, i’d rather have the world matrix as part of the data object itself.