Help with "updating" code
Hi,
Doing Space Shooter tutorial. Trying to get Player object to move ( https://unity3d.com/earn/tutorials/projects/space-shooter/moving-the-player?playlist=17147 ). As annotated in the video, the extension method 'velocity' has been deprecated. I think I have to use "GetCompnent" or something like that but I am unsure on how to. Any push in the right direction would be appreciated.
Answer by SneakyLeprechaun · Aug 21, 2017 at 03:28 AM
I don't think it's the 'velocity' variable that is deprecated, I think it's the shorthand of getting the rigidbody component. In other words, you now have to write Rigidbody rb = gameobject.GetComponent<Rigidbody>()
to access the rigidbody. To access the velocity, you would then just have to write rb.velocity
hope that helped!
Your answer
![](https://koobas.hobune.stream/wayback/20220612133112im_/https://answers.unity.com/themes/thub/images/avi.jpg)