Code For Player Move in Unity:
Language used:
C# Script:
Dont Copy This Code:
Code C#:
![]() |
| All C# Script For Unity. |
For public class:
Public float speed = 6f;
Public float jump = 6f;
Public RigidBody rb;
Private bool IsGrounded = true;
For start class:
Cursor.Visibly = false;
For update class:
Float horizontal = Input.GetAxis("Horizontal") * Time.DeltaTime * speed;
Float vertical = Input.GetAxis("Vertical") * Time.DeltaTime * speed;
Transform.Translate(new Vector3(horizontal, 0, vertical));
(Input.GetKeyDown(KeyCode.Space) && IsGrounded)
rb.AddForce(new Vector3(0, jump, 0), ForceMode.Impulse);
IsGrounded = false;
}
void OnCollisionEnter(Collision player)
if(player.collider.name == "Ground")
{
IsGrounded = true;
}
How to use : If you finish writing this code, put it on your player, then add the Riggedbaddy to the player, then put the Riggedbaddie in its place in the code, and then stick the camera in the player by dragging it to it, to learn more, enter the topics on this site.To learn more about Unity, access the other topics on this site.

