Unity Cheat Sheet

Last Updated: November 21, 2025

C# Basics for Unity

using UnityEngine;

public class PlayerController : MonoBehaviour {
    public float speed = 10f;
    
    void Start() {
        // Called once at start
    }
    
    void Update() {
        // Called every frame
        float move = Input.GetAxis("Horizontal");
        transform.Translate(Vector3.right * move * speed * Time.deltaTime);
    }
}

Common Components

Transform
Position, rotation, scale
Rigidbody
Physics simulation
Collider
Collision detection
Animator
Animation control
AudioSource
Play sounds
Camera
Render view

Input

Input.GetKey
Key held down
Input.GetKeyDown
Key pressed
Input.GetMouseButton
Mouse button
Input.GetAxis
Smooth input (-1 to 1)
💡 Pro Tip: Use Time.deltaTime to make movement frame-rate independent!
← Back to Data Science & ML | Browse all categories | View all cheat sheets