- Home /
Line not working in C#?
I have this short line in java and it doesnt seem to transfer into C#. Anybody know why and how to do it right?
horizontalMovement = Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
The error I am getting is "Expression denotes a type', where a
variable', value' or
method group' was expected". I would be very thankful if someone could help me. Thank you in advance!
Answer by CHPedersen · Sep 26, 2013 at 07:47 PM
Provided HorizontalMovement
is a variable declared elsewhere, the only thing your expression is lacking is a "new" operator:
HorizontalMovement = new Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
Your answer

Follow this Question
Related Questions
2D Character suddenly stops moving for no given reason 1 Answer
2D Character controller that moves in increments. 1 Answer
Continuously rotate a gameobject on 1 axis perpendicularly to another gameobject's normal? 1 Answer
Why is move distance is different for character controller? 0 Answers
How can I move character controller in one direction 0 Answers