Lighter weight Vector3?

So a Vector3 carries a lot of extra weight with properties like up, down, left, right, magnitude, normalized, etc. I want to know, like how Color has the lighter weight Color32, is there a lighter weight Vector3 that only contains x, y, z?

All the properties have no weight at all as they are just methods. They do not require any space for an instance of Vector3. A Vector3 is a struct of 3 float values, that’s it. It has a size of 12 bytes (3 x 4 bytes). So it does indeed only contains x,y and z. The difference between Color and Color32 is just that each color channel is stored as float in the Color struct and as byte in the Color32 struct. However this wouldn’t make any sense for generic vectors as a resolution of 255 values per axis would be pretty pointless for most cases.

Since you haven’t mentioned your usecase we can’t suggest any alternative or workaround if you’re concered about the memory footprint

I don’t think there is a Vector3 light or something. But you could of course just make your own using a struct or class depending on what functions you want it to have. Up, down etc. are just static member and those are shared between all the Vector3’s so I don’t think they will add a lot of extra weight. When creating a new ‘Vector3’, let s call it Hector3, you also lose all the functionality of the Vector3. So when you need to calculate distance between two Hectors or you want to set a transforms position to a Hector, you will have to write extra code to do that. So depending on your case, you should check if creating a Hector will be useful or not.


If you just want to have some variable that contains 3 values and are sure you don’t need the extra pieces, go for a struct / class. And to answer the question. Vector3-light? Probably not…