Cheat Sheet: Shaders and Materials

UNITY CHEAT SHEET: 15

Shaders and Materials Unity- 15.png

Basic Material Properties

  • material.color = Simple color setting
  • material.mainTexture = Main texture assignment
  • material.shader = Shader selection
  • Don't modify these every frame - breaks batching!

Custom Shader Properties

  • SetColor() for specific color properties
  • SetTexture() for custom texture maps
  • SetFloat() for numeric properties (transparency, gloss)
  • SetVector() for Vector3/Vector4 properties
  • Perfect for controlled material modifications

Performance Heroes

  • EnableInstancing for reduced draw calls
  • Proper render queue management for layered effects
  • Shader.WarmupAllShaders() prevents stutters
  • Avoid per-frame property changes
  • Never use Shader.Find() in Update()

Global Shader Control

  • SetGlobalFloat() affects all shaders at once
  • SetGlobalColor() perfect for day/night cycles
  • Override tags for custom rendering passes
  • Efficient for system-wide visual effects

Pro Tips:

  • Cache material references in Awake()
  • Use Shader.PropertyToID to avoid string lookups
  • Enable GPU instancing for repeated meshes
  • Warm up shaders during load screens
  • Use MaterialPropertyBlock for instance variations

Common Pitfalls:

  • Excessive runtime material creation (use sparingly!)
  • Modifying shared materials affects ALL instances
  • Memory leaks from undisposed runtime materials
  • Heavy emission effects on mobile platforms
  • Untested shader compatibility across devices

Cheat Sheet: Physics Rigidbody

UNITY CHEAT SHEET: 14

Rigidbody Unity- 14.png

Basic Movement Controls

  • Velocity: Direct control over object speed and direction
  • AddForce: Apply continuous or instant forces
  • MovePosition: Physics-aware position changes
  • GetPointVelocity: Calculate how fast any point on your object is moving (great for large rotating objects like windmills or swinging wrecking balls)
  • GetRelativePointVelocity: Same as above, but in object's local space (useful for checking speed of specific parts like wheel rims or robot arms)

Rotation Controls

  • Angular Velocity: Control spinning speed
  • AddTorque: Apply rotational forces
  • AddRelativeTorque: Rotation force relative to orientation
  • MoveRotation: Physics-based rotation control

Impact & Physics State

  • AddExplosionForce: Create blast effects with radius and upward force
  • AddForceAtPosition: Apply force at specific world position
  • Sleep: Disable physics temporarily for optimization
  • WakeUp: Re-enable physics calculations
  • IsSleeping: Check if physics simulation is disabled

Core Properties & Management

  • Mass: Affect force impact
  • Drag: Air resistance simulation
  • Angular Drag: Rotational resistance
  • UseGravity: Toggle gravity effects
  • IsKinematic: Switch between physics/script control
  • Constraints: Freeze position/rotation on specific axes
  • Center of Mass: Control physics pivot point
  • ResetCenterOfMass: Return to default center of mass

Force Modes

  • Force: Continuous, mass-dependent
  • Impulse: Instant, mass-dependent
  • VelocityChange: Instant, mass-independent
  • Acceleration: Continuous, mass-independent

Pro Tips:

  • Handle ALL physics in FixedUpdate()
  • Use IsKinematic for cutscenes/animations
  • Combine forces for complex movements
  • Adjust drag for fine-tuned control
  • Reset center of mass when physics behave unexpectedly

Cheat Sheet: Camera

UNITY CHEAT SHEET: 13

Camera Unity- Doc.png

Core Camera Setup

  • Field of View: Controls camera view angle (60° default)
  • Orthographic: Perfect for 2D games, no perspective
  • Aspect Ratio: Screen proportion control (16:9, 4:3)
  • Clip Planes: What's visible to the camera
  • Culling Mask: Which layers to render

Render Settings

  • HDR: Enhanced lighting range
  • MSAA: Smooth edges with anti-aliasing
  • RenderTexture: Custom render outputs
  • Depth Mode: Generate depth information
  • Command Buffers: Custom render passes

Coordinate Systems

  • WorldToScreenPoint: Convert 3D positions to screen space
  • ScreenToWorldPoint: Convert screen clicks to world space
  • ScreenPointToRay: Convert screen position to 3D ray

Physical Camera

  • Physical Mode: Real camera simulation
  • Focal Length: Lens zoom (50mm default)
  • Sensor Size: Match real cameras (36x24mm full frame)

Camera Events

  • OnPreCull: Before visibility check
  • OnPreRender: Before drawing scene
  • OnPostRender: After scene is drawn
  • Multi-Display: Handle multiple screens

Pro Tips

  • Cache main camera reference
  • Keep FOV between 60-90 for most games
  • Use physical camera for cinematic looks
  • Handle aspect ratio changes properly

Common Issues

  • Wrong clip planes causing z-fighting
  • Missing culling mask layers
  • HDR without proper setup
  • Command buffer memory leaks

Cheat Sheet: Collisions

UNITY CHEAT SHEET: 12

Collisions Unity- 12.png

Basic Collider Setup

  • Enabled: Toggle collision detection
  • IsTrigger: Pass-through collision detection
  • PhysicMaterial: Control bounce and friction
  • ContactOffset: Fine-tune collision detection distance

Collider Types & Properties

  • BoxCollider: Simple cubic collision, size & center
  • SphereCollider: Radius-based collision, perfect for rolling
  • CapsuleCollider: Character controllers, standing objects
  • MeshCollider: Complex shape collision, performance heavy
  • TerrainCollider: Landscape collision
  • WheelCollider: Vehicle physics & suspension

Collision Events

  • OnCollisionEnter: First contact
  • OnCollisionStay: Continuous contact
  • OnCollisionExit: End of contact
  • OnTriggerEnter: Enter trigger zone
  • OnTriggerStay: Inside trigger zone
  • OnTriggerExit: Exit trigger zone

Physics Detection

  • Raycast: Line-based object detection
  • BoxCast: Box-shaped detection beam
  • SphereCast: Sphere-shaped detection sweep
  • OverlapSphere: Find objects in radius
  • OverlapBox: Find objects in box area
  • RaycastAll: Get all objects in ray path

Pro Tips

  • Use simple colliders (Box, Sphere) over Mesh for performance
  • Combine multiple simple colliders instead of one complex MeshCollider
  • Cache collision results for better performance
  • Use RaycastNonAlloc for optimized memory usage

Common Pitfalls

  • Setting MeshCollider convex without understanding implications
  • Heavy calculations in collision callbacks
  • Forgetting to set proper collision layers
  • Using too many overlapping colliders
  • Not considering physics performance impact

Cheat Sheet: UI

UNITY CHEAT SHEET: 11

UI.png

Canvas Management

  • RenderMode: Control how your UI renders
  • PixelPerfect: Crisp UI on all resolutions
  • CanvasGroup: Master control for alpha, interaction, and raycasts
  • SortingOrder: Layer management for multiple canvases

RectTransform

  • AnchoredPosition: Precise positioning relative to anchors
  • Anchors & Offsets: Responsive layout control
  • SizeDelta: Size management relative to anchors
  • Pivot: Rotation and scaling reference point

TextMeshPro

  • Rich Text Support
  • Font Style & Size Control
  • Dynamic Text Alignment
  • Color & Material Control

Visual Elements

  • RawImage: Direct texture display
  • Image: Sprite-based visuals with fill controls
  • Color Tinting: Visual state management
  • UV Rect: Texture mapping control

Interactive Elements

  • Button: Click events and state management
  • Slider: Value range controls
  • Toggle: Boolean state management
  • InputField: Text input handling
  • Dropdown: Option selection management

ScrollRect Control

  • Vertical/Horizontal scrolling: Enable scrolling in either direction
  • Normalized position control: Programmatic scroll position (0-1)
  • Viewport & Content Management: Control over scrollable area
  • Scroll Sensitivity & Inertia: Fine-tune scrolling behavior.

Event System

  • Navigation Control
  • Pointer and Touch Detection
  • Raycast Management
  • Module Updates

Pro Tips:

  • Use CanvasGroups for smooth UI transitions
  • Anchor presets for quick responsive layouts
  • Cache references to frequently accessed components
  • Use Layout Groups for dynamic content

Common Pitfalls:

  • Incorrect anchor setup leading to broken layouts
  • Forgetting to set Canvas Camera in World Space mode
  • Not handling different screen resolutions
  • Heavy operations in UI event callbacks
  • Missing references in prefab variants

Cheat Sheet: AI Navmesh Agent

UNITY CHEAT SHEET: 10

AI Navmesh Agent.png

Agent Movement Control

  • SetDestination: Set the destination for the agent
  • isStopped: Emergency brake for your agent
  • speed & angularSpeed: Fine-tune movement
  • acceleration: Control how quickly agent speeds up/slows down
  • radius: Set collision detection size
  • Move: Direct control when needed

State & Information

  • remainingDistance: How far to go
  • pathPending: Is path still calculating?
  • pathStatus: Current navigation status
  • nextPosition: Where agent heads next
  • hasPath: Valid path check
  • autoBraking: Control stopping behavior

Pathfinding & Queries

  • CalculatePath: Manual path planning
  • NavMesh.SamplePosition: Find valid NavMesh positions
  • path: Assign custom navigation paths
  • NavMesh.AddNavMeshData: Dynamic NavMesh updates

OffMeshLink Features

  • isOnOffMeshLink: Check special path segments
  • currentOffMeshLinkData: Get link details
  • ActivateCurrentOffMeshLink(bool): Enable/disable link traversal
  • CompleteOffMeshLink: Finish special path segment
  • autoTraverseOffMeshLink: Automatic link handling

Advanced Control

  • avoidancePriority: Agent collision importance
  • obstacleAvoidanceType: Quality vs Performance
  • Warp: Instant position changes
  • areaMask: Control walkable areas
  • stoppingDistance: Fine-tune arrival precision

CRITICAL Pro Tips:

  • Cache your NavMeshAgent reference in Awake()
  • Always check pathStatus before moving
  • Use NavMesh.SamplePosition before SetDestination
  • Handle OffMeshLinks for jumps/teleports
  • Configure stopping distance carefully
  • Check isStopped && !pathPending to detect obstacles
  • Consider NavMeshObstacle carving performance impact

Common Pitfalls:

  • Setting destination every frame
  • Ignoring path validation
  • Mishandling OffMeshLink activation (forgot the bool parameter)
  • Wrong avoidance settings in crowds
  • Forgetting to clear paths with ResetPath()
  • Not handling pathPending status
  • Assuming positions are valid without SamplePosition check

Cheat Sheet: Animations

UNITY CHEAT SHEET: 9

Animations.png

Parameter Control

  • SetBool/Float/Integer - Control your animation states
  • SetTrigger/ResetTrigger - Manage animation transitions
  • GetBool/Float/Integer - Read current parameter values

Performance Boost

  • StringToHash - Convert parameter names to IDs
  • Use hashed IDs instead of strings
  • Cache hash values at startup

Animation Control

  • Play - Direct animation playback
  • CrossFade - Smooth transitions
  • PlayInFixedTime - Precise timing control
  • StopPlayback - Halt animations

State Management

  • IsInTransition - Check transition status
  • GetCurrentAnimatorStateInfo - Track current state
  • GetNextAnimatorStateInfo - Preview upcoming state
  • Rebind - Reset entire animator

Layer System

  • SetLayerWeight - Fine-tune blending
  • GetLayerWeight - Read blend values
  • GetLayerName/Index - Layer identification
  • Layer indexing for partial animations

Core Properties

  • applyRootMotion - Physics-based movement
  • bodyPosition/Rotation - Direct transforms
  • updateMode - Sync with physics
  • stabilizeFeet - Improved grounding

Events & Timing

  • AnimationEvent - Trigger callbacks
  • Multiple parameter types (float/int/string)
  • Precise timing control
  • Runtime event creation

Animation Curves

  • Linear/EaseInOut - Quick curve creation
  • AddKey/RemoveKey - Custom curve editing
  • MoveKey - Adjust timing
  • Evaluate - Get values at any time

Pro Tips:

  • Always use StringToHash for parameters
  • Cache animator references
  • Use layers for partial body animations
  • CrossFade for smoother transitions

Common Pitfalls:

  • Using string parameters in Update
  • Not resetting triggers
  • Ignoring layer weights
  • Forgetting to handle transitions

Cheat Sheet: Rendering Pipeline

UNITY CHEAT SHEET: 8

Rendering Pipeline.png

Camera Pipeline Settings

  • renderingPath: Forward (mobile) vs Deferred (complex lighting)
  • allowHDR: Extended color range rendering
  • allowMSAA: Multi-sample anti-aliasing control
  • HDR increases memory but enables bloom effects

Quality Configuration

  • antiAliasing: Configure MSAA levels (2x,4x,8x)
  • softParticles: Depth-based particle blending
  • shadowQuality: All/Hard/Disable modes
  • shadowResolution: Memory vs quality trade-off
  • shadowCascades: Split shadow map quality zones

Lighting Controls

  • renderMode: ForcePixel for accurate lighting
  • shadows: Soft shadows with PCF filtering
  • reflectionProbe: Real-time environment mapping
  • ambientMode: Global illumination source
  • lightProbes: Baked lighting data points

Material & Shader Setup

  • globalRenderPipeline: URP/HDRP pipeline selection
  • enableInstancing: GPU batch rendering
  • globalIlluminationFlags: How materials interact with global illumination
  • Custom shader loading and management

Performance Features

  • DrawMeshInstanced: Batch GPU rendering
  • DrawProceduralNow: Direct mesh generation
  • LOD System: Distance-based detail control
  • Probe resolution vs performance balance

Technical Pro-Tips:

  • Forward rendering costs scale with light count
  • Deferred shading suits complex light scenes
  • Each shadow cascade increases memory usage
  • GPU instancing requires compatible meshes

Cheat Sheet: New Input System Part 2

UNITY CHEAT SHEET: 7

Unity New Input System Part 2.png

Interaction Types (Beyond Basic Input)

  • Tap: Quick press & release
  • Hold: Press & hold detection
  • SlowTap: Delayed press recognition
  • MultiTap: Double/triple click handling

How to use:

action.AddBinding().WithInteraction("Hold", duration: 0.5f);


Device Management (The Complete Suite)

  • All Devices: InputSystem.devices
  • All Gamepads: Gamepad.all
  • Current Gamepad: Gamepad.current
  • Enable Device: InputSystem.EnableDevice()
  • Disable Device: InputSystem.DisableDevice()

Haptic Feedback (Full Control)

  • Set Vibration: gamepad.SetMotorSpeeds()
  • Pause Effects: gamepad.PauseHaptics()
  • Resume Effects: gamepad.ResumeHaptics()
  • Stop All: gamepad.ResetHaptics()

Control Schemes (Multi-Platform Done Right)

  • Switch Schemes: playerInput.SwitchCurrentControlScheme()
  • Check Current: playerInput.currentControlScheme
  • Active Devices: playerInput.devices

Advanced Settings & Configuration

  • Update Mode: InputSystem.settings.updateMode

- Fixed Update

- Dynamic Update

- Manual Update

  • Noise Filtering: InputSystem.settings.filterNoiseOnCurrent
  • Input Processing: action.processors = "normalize(min=0,max=1)"

Debugging Tools (Every Dev Must Know)

  • Action State: Debug.Log(action.enabled)
  • Bound Controls: Debug.Log(action.controls)
  • Device Count: Debug.Log(InputSystem.devices.Count)

Pro Tips for Advanced Usage:

  • Use control schemes for seamless platform switching
  • Implement proper haptic feedback for immersion
  • Monitor device connection/disconnection events
  • Process raw input values for custom behavior
  • Profile input performance with Unity's Profiler

Advanced Pitfalls to Avoid:

  • Overusing haptic feedback (battery drain)
  • Not handling device hot-plugging
  • Ignoring input processor overhead
  • Missing platform-specific input quirks
  • Poor control scheme organization

Cheat Sheet: New Input System Part 1

UNITY CHEAT SHEET: 06

Unity New Input System Part 1.png

NEW INPUT SYSTEM:

InputActionMap

  • Container for related input actions
  • Represents a gameplay context/state
  • One map active at a time (like Gameplay, UI, Menu)
  • Enable/Disable entire groups of inputs
  • Switch between maps during state changes
  • Example: "UIMap"- Menu navigation controls

InputAction

  • Single input definition (jump, move, shoot)
  • Can have multiple device bindings
  • Has specific value type (Button/Value/Vector2)
  • Processes input through interactions
  • Can modify input through processors

Setup

  • [SerializeField] InputActionAsset asset - Reference in Inspector
  • [SerializeField] PlayerInput playerInput - Add component
  • InputActionMap gameplayMap - Reference in script
  • InputAction moveAction - Individual action reference

Action Map Setup

  • Create: new InputActionMap("GameplayMap")
  • Enable: gameplayMap.Enable()
  • Disable: gameplayMap.Disable()
  • Get Action: gameplayMap.FindAction("move")

InputAction Properties

  • Name: Unique identifier
  • Type: Button/Value/Vector2
  • Control Scheme: Device grouping
  • Interactions: Tap/Hold/Press
  • Processors: Normalize/Invert/Scale

InputAction Phases

  • Started: Input begins
  • Performed: Input recognized
  • Canceled: Input ends

Binding Syntax

  • Single Key: "<Keyboard>/space"
  • Modifiers: "<Keyboard>/leftShift+w"
  • Mouse: "<Mouse>/position", "<Mouse>/scroll/y"
  • Gamepad: "<Gamepad>/buttonSouth", "<Gamepad>/rightTrigger"
  • Touch: "<Touchscreen>/touch*/position"
  • VR: "<XRController>{RightHand}/trigger"

Input Reading Methods

  • moveAction.ReadValue<Vector2>()
  • shootAction.ReadValue<float>()
  • jumpAction.IsPressed()
  • jumpAction.WasPressedThisFrame()
  • jumpAction.WasReleasedThisFrame()

Event System Methods

  • moveAction.performed += OnMove
  • moveAction.started += OnMoveStart
  • moveAction.canceled += OnMoveEnd
  • InputSystem.onDeviceChange += OnDeviceChange
  • playerInput.onActionTriggered += OnAction

Required Function Implementations

  • Awake(): Cache action references
  • OnEnable(): Subscribe to events
  • OnDisable(): Unsubscribe from events
  • OnMove(CallbackContext): Handle input
  • OnDestroy(): Cleanup

Runtime Checks Required

  • Null action references
  • Action enabled status
  • Valid bindings exist
  • Device connectivity
  • Control scheme validity

Cheat Sheet: Debugging

UNITY CHEAT SHEET: 05

Code Unity Debug Cheat Sheet.png

Console Debugging

  • Debug.Log(): For general info tracking
  • Debug.LogWarning(): Non-critical issues
  • Debug.LogError(): Critical problems
  • Debug.LogAssertion(): Condition validation
  • Debug.LogException(): Exception tracking

Scene View Debugging

  • Debug.DrawLine(): Visualize connections & paths
  • Debug.DrawRay(): Show raycasts & sight lines
  • OnDrawGizmos(): Always visible scene markers
  • OnDrawGizmosSelected(): Selected object markers

Performance Profiling

  • ProfilerMarker: Modern, low-overhead profiling
  • Profiler.BeginSample: Legacy but flexible
  • Editor Profiler Window: Deep performance analysis

Physics Debugging

  • Physics.IgnoreCollision(): Ignore collisions between specific objects
  • Physics.OverlapSphere(): Check for objects in a given radius

Network & Input Debugging

  • Application.internetReachability: Check network connectivity
  • SystemInfo.deviceName: Log the current device’s name
  • Input.GetKeyDown(): Track keypresses during gameplay
  • Input.mousePosition: Log mouse position for UI debugging

Pro Tips:

  • Never leave Debug.Logs in production builds
  • Use conditional compilation for debug code
  • Keep Gizmos clean and organized
  • Profile specific sections, not entire methods

Common Mistakes:

  • Debug spam in Update() methods
  • Forgetting to remove debug code
  • Using wrong log levels
  • Not cleaning up profiler markers
  • Over-relying on console logs

Cheat Sheet: Inspector Attributes

UNITY CHEAT SHEET: 4

Unity Attributes Cheat Sheet.png

Core Serialization

  • [SerializeField]: The RIGHT way to show private fields
  • [Serializable]: Make ANY class appear in the Inspector
  • [NonSerialized]: Keep that public field out of serialization
  • [FormerlySerializedAs]: Rename without breaking everything!

Inspector Magic

  • [Header]: Group your variables like a pro
  • [Tooltip]: Help text that future-you will thank you for
  • [Space]: Give your Inspector room to breathe
  • [TextArea]/[Multiline]: Perfect for those long text fields
  • [ColorUsage]: HDR colors? Alpha? You got it!

Value Control

  • [Range]: Sliders for numbers, no more typing!
  • [Min]/[Max]: Set boundaries, prevent disasters
  • [Delayed]: Update only when you're done typing
  • [EnumFlags]: Multi-select enums, finally!

Editor

  • [ExecuteInEditMode]/[ExecuteAlways]: Live updates without play
  • [CustomEditor]: Build your dream, Inspector
  • [CreateAssetMenu]: Custom assets made easy
  • [PropertyDrawer]: Your fields, your rules

Component Control

  • [DisallowMultipleComponent]: Keep it unique
  • [AddComponentMenu]: Organize that Components menu
  • [DefaultExecutionOrder]: Control the flow
  • [CanEditMultipleObjects]: Batch edit like a boss

Pro Tips:

  • Cache serialized references in Awake()
  • Use [Header] + [Tooltip] combo for crystal clear organization
  • [SerializeField] > public for better encapsulation
  • Group related fields with [Space]

Common Pitfalls:

  • Making fields public just for Inspector visibility
  • Forgetting [Serializable] on custom classes
  • Not using [Range] for numeric limits
  • Messy Inspector organization

Cheat Sheet: Data Structures

UNITY CHEAT SHEET: 3

Unity Data Structures Classic & Native.png

Basic Collections (Managed)

  • Arrays: Fast, fixed-size, perfect for known collections
  • List<T>: Flexible size but watch for GC spikes
  • Dictionary<K,V>: Lightning-fast lookups, memory hungry

Common Issues:

  • All generate garbage collection
  • Can cause memory fragmentation
  • Performance degrades with large datasets

Specialized Unity Collections

  • SerializedDictionary: Editor-friendly, great for config data
  • ObservableList: Perfect for UI-bound collections
  • CircularBuffer: Ideal for command history, rolling stats
  • ObjectPool: Must-have for spawning systems

Issues:

  • More complex than standard collections
  • Higher memory overhead
  • Require careful implementation

High Performance (Native)

  • NativeArray: Burst-compatible, no GC overhead
  • NativeList: Dynamic size without the GC cost
  • NativeHashMap: High-performance lookups in Jobs

Issues:

  • Must manually manage memory (Dispose)
  • Not visible in Inspector
  • More complex to debug

Pro Tips:

  • Always profile before optimizing
  • Start simple (List/Array) before going native
  • Use ObjectPools for frequently spawned objects
  • Don't forget to Dispose() native collections!

Common Pitfalls:

  • Using List<T> in performance-critical loops
  • Forgetting to pre-allocate capacities
  • Missing Dispose() calls on Native collections
  • Over-engineering with complex structures too early

Cheat Sheet: Component Communication

UNITY CHEAT SHEET: 2

Code Component Communication.png

The Performance Killers:

  • Calling Find() or FindObjectOfType() in Update()
  • GetComponent() every frame
  • Searching entire hierarchies repeatedly
  • Multiple GetComponentInChildren() calls per frame

The Performance Heroes:

  • Cached references in Awake()
  • SerializeField in Inspector
  • GetComponent for local components
  • One-time initialization searches

WHEN TO USE WHAT:

1. GameObject.Find() & FindObjectOfType()

  • One-time setup in Awake()
  • Prototyping & quick tests
  • Not for regular gameplay updates
  • Not for physics or input handling

2. GetComponent<T>()

  • Getting sibling components
  • Initialization in Awake/Start
  • Not for every frame updates
  • Not for repeatedly accessing the same component

3. GetComponentInChildren<T>()

  • One-time setup of hierarchies
  • Prefab initialization
  • Not for continuous parent-child communication
  • Not for frame-by-frame checks

Pro Tips:

  • Cache everything you'll use more than once
  • Use [SerializeField] for direct references
  • Design hierarchies to minimize searches
  • Consider Scriptable Objects for global data

ALL THE COMPONENT COMMUNICATION FUNCTIONS:

Direct References

  • GetComponent<T>()
  • GetComponents<T>()
  • GetComponentInChildren<T>()
  • GetComponentInParent<T>()
  • FindObjectOfType<T>()
  • FindObjectsOfType<T>()

Search Methods

  • Find()
  • FindWithTag()
  • FindGameObjectsWithTag()

Cheat Sheet: Event Functions

UNITY CHEAT SHEET: 1

Code Unity Event Functions.png

Initialization & Lifecycle

  • Awake(): First! Before ANY Start()
  • OnEnable(): Object/Component activation
  • Start(): Before first frame, after ALL Awake()
  • OnDisable(): Component deactivation
  • OnDestroy(): Final cleanup

Update Loops

  • Update(): Every frame
  • FixedUpdate(): Fixed timestep (physics)
  • LateUpdate(): After all Updates

Physics & Collisions

  • OnCollisionEnter(): First contact
  • OnCollisionStay(): During contact
  • OnCollisionExit(): Contact ends
  • OnTriggerEnter(): Enter trigger zone
  • OnTriggerStay(): Inside trigger
  • OnTriggerExit(): Exit trigger

Rendering & Visibility

  • OnBecameVisible(): Enters camera view
  • OnBecameInvisible(): Exits all views
  • OnRenderObject(): After camera render
  • OnWillRenderObject(): Before camera render
  • OnGUI(): UI/Debug rendering

Application Flow

  • OnApplicationFocus(): Window focus
  • OnApplicationPause(): App pause/resume
  • OnApplicationQuit(): Before app closes

Input & Interaction

  • OnMouseEnter(): Mouse enters collider
  • OnMouseOver(): Mouse stays over collider
  • OnMouseExit(): Mouse leaves collider
  • OnMouseDown(): Mouse click on collider
  • OnMouseUp(): Mouse release on collider
  • OnMouseDrag(): Mouse drag on collider

Editor & Development

  • OnDrawGizmos(): Draw debug in Scene view
  • OnDrawGizmosSelected(): Draw when selected
  • OnValidate(): After inspector value change

CRITICAL Pro Tips:

  • Awake() runs before ANY Start() - perfect for manager initialization
  • Never reference other objects in Awake() - they might not be ready
  • Physics ONLY in FixedUpdate()
  • Camera follow in LateUpdate()
  • OnEnable/OnDisable for event subscriptions
  • Input handling belongs in Update()
  • OnValidate() for inspector value validation
  • Use OnDrawGizmos() for debug visualization
  • OnMouseOver() only works with colliders

Common Pitfalls:

  • Running physics in Update()
  • Initializing dependencies in wrong order
  • Missing OnDisable() cleanup
  • Heavy calculations in OnGUI()
  • Forgetting collider requirement for mouse events
  • Not handling OnApplicationPause() on mobile
  • Using OnMouseDrag() for UI elements

Get all Unity Cheat Sheets in your mail