Skip to content

[Bug] - Casting Int to Float Throw InvalidCastException: Instance of JsonData doesn't hold a double #94

Open
@levey-lee

Description

@levey-lee

This happens when casting an integer in an array to a float.

For example:
If we have an array of int like this: [0,1,2] where we use it as a vector3. In our code, Json will throw an exception if we cast it like (float)data[0].

My workaround:
I have to do an integer cast then float cast from system. It will work if you do (float)(int)data[0]. However, you need to make sure the type is int or long, otherwise you will lose float precise for other floating point data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions