Question by
theTrueJellyfish · Jan 27, 2019 at 02:34 PM ·
script.locationwhy
When and why do I need to use new vector2 instead of just vector2,When and why do you need to call new vector2 instead of just vector2?
I understand the concept of vector2 but not exactly when it is appropriate to use new vector2 instead of vector2.
Comment
Best Answer
Answer by tormentoarmagedoom · Jan 27, 2019 at 04:53 PM
Good day.
If you are generating a vector by giving its components, you need to use new vector. Like
Something = new Vector2 (12,-2);
But if you want to use an existing vector you do like vector2.right or vector2.zero
So vector.anything would be using an existing vector?
Vector2.one
is just a shorthand to new Vector2( 1, 1 )
(it's a getter). The same apply to other vectors.