Question by
Bartix20 · Oct 18, 2015 at 05:59 PM ·
error messagenewbie
error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
I am new to the creation in C # . I do not know how to solve this problem . Can you help ?
zrzut.jpg
(11.0 kB)
Comment
Answer by meat5000 · Oct 18, 2015 at 05:58 PM
A - B means nothing as you dont store the result.
C = A - B has a lot more meaning.
You mean to do velocity = new vector.
Or if you were trying to take away from the velocity you mean
velocity = velocity - new vector.
Answer by JeevanjotSingh · Oct 18, 2015 at 06:34 PM
Try changing
GetComponent<Rigidbody2d>().velocity-=new Vector2(0, jumphight*time.deltatime);
Or
GetComponent<Rigidbody2d>().velocity-=new Vector2(0, jumphight)*time.deltatime;
Or Simply How meat5000 said
GetComponent<Rigidbody2d>().velocity-=new Vector2(0, jumphight);