android - Unity error CS0119 moving an object -
i started learning programming in unity - moved eclipse, android studio. , followed tutorial in youtube error :
assets/scripts/move.cs(9,17): error cs0119: expression denotes `method group', `variable', `value' or `type' expected
my simple code:
using unityengine; using system.collections; public class move : monobehaviour { void fixedupdate(){ float movehorizontal = input.getaxis ("horizontal"); float movevertical = input.getaxis ("vertical"); vector3 movement = new vector3 (movehorizontal, 0.0f, movevertical); getcomponent<rigidbody>.velocity = movement; } }
usually problem in constructor word new saw online, had time, what's different tutorial online here : https://www.youtube.com/watch?t=206&v=rvslczg1m1e line rigidbody.velocity=movement
gave me errors looked online , changed still give me error. thank
this line incorrect
getcomponent<rigidbody>.velocity = movement;
it should read
getcomponent<rigidbody>().velocity = movement;
with parenthesis.
Comments
Post a Comment