I am currently doing a lot of 2D texture based work, for which I am currently using Vector2 to store x,y coordinates. However, due to Vector2's x and y being floats, I have to typecast a lot in my source. There is no use for the floating point because all of these all pixel based coordinates, and therefore whole numbers. I just use Vector2 because it is handy to store an x and y :)
Is there a class for this, or do I have to write my own struct for this?
asked Mar 08, 2011 at 08:07 PM
There is no such class or struct built into Unity.
Easy to implement though (C#) ...
You would probably want to follow the example of Vector2 and implement as many of its methods as make sense for your application. I've shown sqrMagnitude as an example.
answered Mar 08, 2011 at 08:16 PM
I might recommend just writing an extension method, so that you don't have to rewrite everything, like yoyo said.
answered Mar 08, 2011 at 09:02 PM