Can’t seem to find anything from the Google on this.
All of my vectors are now Vector2. What gives with this error?
Can’t seem to find anything from the Google on this.
All of my vectors are now Vector2. What gives with this error?
Please post the line of code that this error refers to.
Arithmetic operators +.-. and others, are just normal functions wich accepts two parameters and returns one value, wich is the result of operation. I can be defined like this:
public static MyType operator+(MyType a, MyType b){
return whatever sum of a and b is;
}
There are operators + for both Vector2+Vector2 and another one for Vector3+Vector3. But when both Vector2 and Vector3 are used in one formula, the compiler can’t decide wich one to choose because Vector2 can be converted to Vector3 and vice versa.
It will work if you manually cast one of vectors:
var a = Vector2.one;
var b = Vector3.one;
var c = a + (Vector2)b; // valid
var d = (Vector3)a + b; // valid
var e = a + b; // error