- Home /
Question by
Samir 1 · May 08, 2011 at 05:00 PM ·
functionsyntax-errorreturn
Error c#, using return with variable
i am getting an error with my c# script when i try to convert from jscript.
public Vector3 climbDirection;
public void ClimbDirection()
{ return climbDirection; }
the error says since this is void, a return keyword must not be followed by an object expression.
any help? thank you :P
Comment
Best Answer
Answer by GesterX · May 08, 2011 at 05:03 PM
The error is telling you exactly what's wrong:
Your function is returning "climbDown" which is a Vector3. But your function has a return type of void (aka don't return anything). You should have:
public Vector3 ClimbDirection()
{
return climbDirection;
}