Will Unity ever migrate the GameObject stack to float3 instead of Vector3?

I personally use DOTS for some of my larger projects, but I still rely on GameObjects for smaller games where I don’t need mass entity performance. However, I always miss float3/float2 when I do so. The float3/float2 types from the “Mathematics” package and the accompanying math library just feel so much more well-thought-out and designed in terms of consistency and ease of use than Vector3. Just the fact that it allows you to “myfloat3.xy” to get a float2 is super convenient.

I try to to create conversion points in the codebase to accommodate float3. Especially so I can create Unity and stack independent common code (using float3/float2). But this results in numerous unnecessary conversions everywhere.
Implementing floatX for GameObjects would also reduce the conversions required in hybrid DOTS+GameObjects projects.

I understand its a huge endeavour. But personally I would argue its something that eventually needs to happen. If nothing else just for standardization and reducing the cognitive load for people new to unity.

Luckily float3/2 implicit cast to Vector3/2 so its not that much that has to happen. Main thing IMO would be to get out a float3 from “Transform.position”.

2 Likes

Automatic conversion would handle Vector3 → float3 easily.
Biggest issue would be not swapping type itself, but the actual math underneath [see as user domain code] that uses Vector3.

Also, casting isn’t free.
While its not noticable on small numbers, it will hinder performance when scaled to the size of engine + user domain code.

Plus, math library operations sometimes do not map 1-to-1 in a way Vector3 does.
There are a lot of edgecases inexperienced people would run into. Same applies to the Quaternion ↔ quaternion btw.
And there’s also matrices.

So in the end, everything must transition in one pass.

As for the separate API - its kinda good and bad idea at the same time.
From experience - Unity never removes legacy API, which causes more issues than it solves.
[This has to change, but its a different topic]
So leaving, Vector3 for example, to linger for 10+ years as transform.v3position would be nasty.

Tl;DR: It would be great. But I doubt it will ever happen.

4 Likes