Casting int to float

What’s the expected manner to cast int to float? For that matter, what’s the expected manner in which I should be casting things? Should it be automatic between nodes? From experience so far, it seems like casting should be part of the noodle rather than a node.

If it is, I’ve found a few cases where it isn’t doing the thing.

Oh, this wasn’t tracked

Right now, udon will only implicitly handle casts between child/parent types (eg: transform<->component)
Like you said, ideally it would handle casting between reasonably implicit types like (float<->int), but that’s not currently supported.

The current expected manner to handle those casts is explicitly with a node to convert the type.

1 Like

Gotcha, I suppose I’ll have to wait a bit then :cry:

wait for the implicit handling, yeah.
in the meantime, if you find some obviously castable types you can’t figure out how to cast even with a node, then raise that as a bug report.
I think we included the Convert class, which should handle most of the cases.

I am using Graham’s timer and converting the float to an int and printing the seconds to console

AOVY2U7kRhT9FfCzC9XmWlriZQYUoYySSEC/RKhVK+PE2MgLCQK+bB7ySfmFXAPdLOUk1qRJMhp1q9Xl9nLOvefce6t///TbTXZlqiFkix9vsjhU1XfmAhbZaV3214f1eVmHg2CH873V6kNzvlodX3d9uPje/hRcv14tm9JneTbA5yLzVEZCqEYqWos4ZhhZwwjyXvsiMEeVx3DyZdOVfdnU2eIm+zVbECL4Hs6z62wB16g9fJdndePD6dFBB9CyIKLnQkrkrAqIGyWRcYIiEwRVhWPRR3yLs7M8i1Xzy+NVZw/3WI78unuCw8jqAfzygfVNVtZdb2oXjg6yxfjYrm/L+vzx5yy7O7vLX0Tmm9CvlqYtja3ChjU2QTHNKCq4xwiQRmS5MggXmDImcCCiSFnTJ9JM8YT0G9B5SNje8f3BfOeic01blTbfWYa2A2D7gGJ85Tvvh6of2rBfh6FvTZXv/DDYqnTfhuuT5udQ71spTeEKQTTjASt9iyENhhvIToE94jEYpHgkiHHHQAFMEx3TaD4Aet/UV6HtQWQnzVHdMzottPufNjGfo4k05oLQTcy1SGI+J5GJ0OaJ/m3kuJbiY4iO4eTnupyTlCRGbBMiOn59Lct8/X4Lu+X/M1n3pj0P/UkJwf5H2N41TRVMvV1wJ+3wubBSJR1ehbpfnV560z8JKERjowYrRKxB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