--- id: wiki-2026-0508-unity title: Unity category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Unity Engine, Unity3D, Unity 6] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [game-engine, c-sharp, realtime, multiplayer, dots] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: C# framework: Unity 6 (DOTS, Netcode for GameObjects) --- # Unity ## 매 한 줄 > **"매 cross-platform realtime engine 의 component 기반 scene graph + 매 C# scripting 의 ECS hybrid"**. 2005 OS X-only IDE 로 출발, 2026 Unity 6 의 DOTS (Data-Oriented Tech Stack) + URP/HDRP + Netcode 가 indie ~ AAA 까지 cover. 매 backend 관점: dedicated game server, matchmaking, persistence layer 가 hot path. ## 매 핵심 ### 매 GameObject + Component - `GameObject` = container, `MonoBehaviour` 매 lifecycle hook (`Awake → Start → Update → FixedUpdate → LateUpdate`). - 매 inheritance 보다 composition 우선 — 매 `RequireComponent` 의 사용. ### 매 ECS / DOTS - `Entity` (ID) + `IComponentData` (struct) + `SystemBase` (logic). 매 Burst compiler + Job system 의 SIMD/multi-thread. - 100k+ entities @ 60fps 가 mobile 에서도 가능. ### 매 Networking - Netcode for GameObjects (NGO) — 매 NetworkBehaviour, NetworkVariable, ClientRpc/ServerRpc. - DGS (Dedicated Game Server) on Unity Multiplay (Unity Cloud) 또는 self-host (k8s). ### 매 응용 1. 매 mobile/PC/console game (Genshin-style live ops 포함). 2. 매 AR/VR (XR Interaction Toolkit, visionOS). 3. 매 digital twin / BIM 시각화 (non-game enterprise). ## 💻 패턴 ### MonoBehaviour 기본 ```csharp using UnityEngine; public class PlayerController : MonoBehaviour { [SerializeField] float speed = 5f; Rigidbody rb; void Awake() => rb = GetComponent(); void FixedUpdate() { var input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); rb.MovePosition(rb.position + input * speed * Time.fixedDeltaTime); } } ``` ### DOTS / ECS System ```csharp using Unity.Burst; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; [BurstCompile] public partial struct MoveSystem : ISystem { public void OnUpdate(ref SystemState state) { float dt = SystemAPI.Time.DeltaTime; foreach (var (transform, vel) in SystemAPI.Query, RefRO>()) transform.ValueRW.Position += vel.ValueRO.Value * dt; } } ``` ### Netcode RPC ```csharp public class PlayerNet : NetworkBehaviour { [ServerRpc] public void FireServerRpc(Vector3 dir) { // server-authoritative damage SpawnProjectileClientRpc(dir); } [ClientRpc] void SpawnProjectileClientRpc(Vector3 dir) { /* visual only */ } } ``` ### Addressables (async asset load) ```csharp var handle = Addressables.LoadAssetAsync("Boss/FinalBoss"); var prefab = await handle.Task; Instantiate(prefab, spawnPoint.position, Quaternion.identity); ``` ### ScriptableObject (data-driven) ```csharp [CreateAssetMenu(menuName="Game/WeaponDef")] public class WeaponDef : ScriptableObject { public int damage; public float fireRate; public AudioClip sfx; } ``` ### UniTask (struct-based async) ```csharp async UniTaskVoid LoadScene() { await SceneManager.LoadSceneAsync("Boss").ToUniTask(); await UniTask.Delay(500); BossUI.Show(); } ``` ### Dedicated Server build ```bash # Linux server build via CLI Unity -batchmode -nographics -quit \ -buildTarget LinuxServer \ -executeMethod Builder.BuildServer \ -projectPath . -logFile build.log ``` ## 매 결정 기준 | 상황 | Approach | |---|---| | Indie 2D/3D, fast iteration | MonoBehaviour + URP | | 10k+ units (RTS, swarm) | DOTS + Burst | | Authoritative multiplayer | Netcode + DGS on Multiplay | | Cross-platform UI tool | UI Toolkit (UXML/USS) | | 매 cinematic | Timeline + Cinemachine | **기본값**: MonoBehaviour + URP + Addressables. Scale 한계 도달 시 hot path 만 DOTS 로 migrate. ## 🔗 Graph ## 🤖 LLM 활용 **언제**: boilerplate MonoBehaviour, shader scaffolding, editor tool script, ECS conversion outline. **언제 X**: 매 performance-critical hot loop (LLM 의 GC alloc 무지) / 매 latest API breaking changes (Unity 6 → 7 transition). ## ❌ 안티패턴 - **Update() everywhere**: 매 frame 의 `GetComponent` / `Find` 호출. Cache in Awake. - **String-based GameObject.Find**: 매 fragile + slow. Use serialized refs. - **Coroutine for heavy work**: 매 main thread block. Use Job system or async. - **Resources/ folder abuse**: 매 build size bloat. Use Addressables. - **No object pooling**: 매 bullet/particle spam → GC spike. Pool everything reusable. ## 🧪 검증 / 중복 - Verified (Unity 6 docs, Unite 2025 sessions). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — Unity 6 + DOTS + Netcode 패턴 정리 |