mjl1966
1
Catch 22.
Vector2 SomeVector();
{
Vector2 SomeLocalThing;
SomeLocalThing.y=GetSomethingValueFunction();
return SomeLocalThing;
}
This, of course, throws “use of unassigned local variable” error. The common fix I have seen is to set the local variable to null to start with. But, wait, you can’t set Vector2 to null. So, dead end.
Using a local variable of ANY type in a function should be possible. (Otherwise what’t the point of having functions?)
At any rate, how do I have a non-nullable local variable in a function?
Thanks.
It it says unassigned variable, then proper thing for structs and classes is:
Vector2 v = new Vector2();