9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
163 lines
4.9 KiB
Markdown
163 lines
4.9 KiB
Markdown
---
|
|
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<Rigidbody>();
|
|
|
|
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<RefRW<LocalTransform>, RefRO<Velocity>>())
|
|
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<GameObject>("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 패턴 정리 |
|