How do you set a speed of of an object

Help I am stuck on this piece of code to set the speed of my object
I don’t know how to finish this piece
private float speed 5f
If you can help thanks!

tk

You should look more into general syntax for C#, or follow the Learn Tutorials here on Unity. You are simply missing an equals sign and semi colon, like such:

private float speed = 5f;
3 Likes

By the looks of it, you may also want to learn about RigidBodies(2D) if you want to set your object into motion