(0)
 (0)
 (0)

🎯 25 Unity Tips You Probably Didn’t Know

 

🖥️ Editor & Workflow

Hierarchy Search Filters – In the Hierarchy, type t:Light or t:Camera to show only those components. Great for debugging big scenes.

Lock the Inspector – Click the little padlock to inspect one object while selecting another. Super useful for drag-dropping references.

Presets for Components – Right-click a component → Save as Preset. Next time you add that component, just load the preset. Instant setup.

Editor Coroutines – Yes, coroutines can run in the editor! Great for making editor tools that animate or wait.

Play Mode Tint – Preferences → Colors → Playmode Tint. Saves you from editing your scene by mistake when in Play mode.

 

💻 Scripting

TryGetComponent – Instead of GetComponent<> + null check, use if (TryGetComponent(out Rigidbody rb)) { … }. Cleaner, safer, faster.

nameof() – Replace Debug.Log("PlayerController not found") with Debug.Log($"{nameof(PlayerController)} not found"). No more broken strings when renaming classes.

Range Attribute – [Range(0, 10)] public float speed; gives you a slider in the Inspector. Stops you from accidentally putting “99999”.

ScriptableObjects as Config Data – Store weapon stats, enemy HP, or UI theme colors in ScriptableObjects instead of hardcoding.

Extension Methods – Write your own “.ResetPosition()” or “.SetAlpha()” functions for commonly used actions.

 

🎨 UI & UX

Disable Raycast Target – On decorative Images/TextMeshPro, uncheck “Raycast Target”. Otherwise, invisible UI blocks your buttons.

Canvas Rebuilds Are Expensive – Avoid modifying the hierarchy of UI elements every frame (e.g., setting text in Update). Cache values and update only when needed.

Use World Space Canvas – Perfect for health bars or names floating above characters. No need for extra scripts.

Sorting Popups – Put each Canvas on its own sorting layer. That way, modals, menus, and popups won’t fight for draw order.

GraphicRaycaster Filters – You can disable raycasts on entire Canvases when they’re not interactable, saving performance.

 

🎥 Cameras

Cinemachine Confiner – Add a 2D collider and Cinemachine will keep the camera inside it. No more manual clamps.

Pixel Perfect Camera – Essential for 2D pixel art. Prevents shimmering and blurring.

Separate UI Camera – Have one camera only for UI. Keeps UI crisp while your world camera uses effects and depth.

 

⚡ Performance

Static Batching vs Dynamic Batching – Mark static geometry as “Static” to combine them into one draw call. Don’t rely on dynamic batching (it’s slower).

GPU Instancing – Check “Enable GPU Instancing” on materials for armies of identical objects (trees, enemies, bullets).

Pooling > Destroy – Don’t Destroy() bullets or enemies every frame. Pool them. GC allocations will kill your FPS otherwise.

Renderer.enabled – If you just need to hide something, use renderer.enabled = false instead of disabling the entire GameObject. Way cheaper.

 

🧑‍💻 Debugging

Debug.DrawRay() – Visualize raycasts in the Scene view while testing. Saves hours of guessing where your shots go.

OnDrawGizmos – Add debug visuals in the Scene (like enemy vision cones or spawn zones). Super handy for level design.

Profiler → GC Allocations – Watch out for spikes. If you see “0.02 MB Alloc” in Update, you’re creating garbage every frame (usually from new or string concat).

 

✅ These 25 aren’t the usual beginner tricks — they’re things that actually prevent headaches in real projects.