#How do i fix this?
1 messages · Page 1 of 1 (latest)
Mathf.Abs takes a float.
You are giving it a Vector2.
You will need to get a float from that vector in one way or another; likely what you want is velocity.x.
velocity.y and velocity.magnitude would aldo be possible contenders.
I'm sorry but i dont understand what you are saying
I only recently started learning unity so i dont know alot abt it
This is less of a Unity that a C# problem.
If you don't know the basics of C# yet, I suggest you learn them before learning Unity.
"rb.velocity is not a valid parameter type for Mathf.Abs. Use rb.velocity.x instead"
When i did the rb.velocity.x it showed this when i moved
Have you read the error message?
i was dumb and put it in there when the game was active (when that happends it dont save)
but its fixed now
tysm
Yeah, that's something everyone does sometime - especially when starting out.
To help you not do this, you can set the playmode tint of your editor to a color that you'll notice; that way you will be more aware of when you are in play mode.
You're welcome 🙂
Do you understand why the change I suggested fixed it?