Project_WL/CLAUDE.md

71 lines
6.7 KiB
Markdown
Raw Normal View History

# WL 프로젝트 (힘민지 기반 · What's your level?) — Unity 에디터 제어 가이드
Unity **6000.3.23f1** · URP 17.3 · 3D 액션 RPG · 레거시 Input(`activeInputHandler: 0`) · PlayFab(개발 `D1149` · 라이브 `CD90A`) · Addressables 2.x.
2026-09-05 PD 결정으로 힘민지(`kumatrio/nn_himminji` Dev · 2022.3.55f1)를 WL 의 본체로 채택하고 Unity 6 로 제자리 업그레이드했다.
조직 규칙·세션 절차의 SOT 는 NerdNavisAi 레포의 `profile-wl` 스킬이고, 이 파일은 **이 프로젝트에서 에이전트가 Unity 에디터를 다루는 방법**만 다룬다.
시스템 카탈로그(전투·테이블·UI·메타·서버)는 NerdNavisAi `himminji-reuse` 스킬(`references/01~07`)이 이 코드베이스 기준으로 작성돼 있다.
## 1. 에디터 제어 = Unity 공식 CLI + Pipeline 패키지 (커뮤니티 unity-mcp 사용 금지)
- `com.unity.pipeline` 0.6.0-exp.1 이 manifest 에 있고, 에디터가 켜져 있으면 Pipeline 서버가 자동 기동한다(포트 7800~7849 · 포트·토큰 파일 `Library/Pipeline/.unity-pipeline-port`).
- 호출 방식 = `unity command <이름> [--인자 값]` 을 Bash/PowerShell 도구로 직접 실행(기본). MCP 서버 `unity` 는 보조 경로.
- Windows 경로 인자가 들어가는 명령은 **PowerShell** 로. `unity` 를 못 찾으면 이 PC 는 `%LOCALAPPDATA%\Microsoft\WindowsApps\unity.exe`(winget MSIX 별칭).
- 명령 목록·인자 = `unity command` (이름 없이). CLI 는 베타 — `unity <명령> --help` 로 문법 재확인.
- 여러 줄 C# 은 `.cs` 파일로 두고 `unity command eval_file --file <경로>` (`using` 불가 · 네임스페이스 풀어 쓰기 · 첫 Roslyn 컴파일은 `--timeout 60`). 대량 작업은 `run_script --file AgentScripts/X.cs --entry X.Run`. 큰따옴표가 든 코드를 `eval --code` 로 밀어 넣지 않는다.
- 사용 규칙·함정(오브젝트는 `instanceId` 로 지정 · Play 중 `recompile` 금지 · `add/remove_component` 오류 시 `eval_file` 우회 · 프리팹은 `LoadPrefabContents→SaveAsPrefabAsset→UnloadPrefabContents` · `[SerializeField] List<T>` 는 정확한 제네릭 타입 · 캡처는 `Assets/` 밖으로 이동) = NerdNavisAi `profile-wl` 교훈 인덱스. 이 프로젝트는 **레거시 Input** 이라 런타임 입력 주입은 `simulate_pointer`·`simulate_key` 로.
## 2. 세션 시작 체크 (순서대로)
```powershell
unity status # 이 프로젝트가 ready 로 보이는지 (포트·PID)
unity command editor_status # playing / compiling / blocked_by_dialog 확인 (오픈 직후는 --timeout 60)
unity command set_autotick --enable true # 포커스 없어도 컴파일·테스트 진행 (필수)
```
- `editor_status``playing` 이면 PD 가 테스트 중일 수 있다 → 리컴파일·Play 전환·씬 저장 전 PD 확인. `blocked_by_dialog` 면 제목·메시지를 PD 에게 보고(CLI 로 못 닫는다).
- 에디터가 여러 개면 `--project-path E:\NerdNavis\nn_himminji` 로 대상을 고정한다. `unity close` 는 Hub/CLI 로 띄운 에디터만 잡는다.
- 🔴 **빌드 타겟은 Android 여야 컴파일된다**`Assets/Script/Info/TitleInfo.cs``#if UNITY_ANDROID … #else` 분기가 걷어낸 Firebase Auth 를 참조한다. 새 Library 로 열면 Standalone 으로 초기화되니 `unity open <경로> --build-target Android` 또는 `unity command switch_build_target` 로 맞춘다.
## 3. 코드 수정 → 검증 루프
```powershell
unity command recompile
unity command recompile_status # completed | up_to_date 까지 반복 (failed 면 errors 배열 확인)
unity command get_console_logs --severity error --limit 20
```
- 컴파일 판정 = `recompile_status` completed/up_to_date **이고** 콘솔 error 0 (조직 C39). 도메인 리로드 중 연결 오류는 정상. 종료 코드 2 = 인자 오류, 6 = 에디터 쪽 실패.
- 콘솔 경고 614줄(테이블 문자열 ↔ enum 불일치 `[Not Defined ePurpose/eStat]` 588 · 걷어낸 SDK 컴포넌트 `referenced script missing` 26)은 레포 데이터 고유 — 에러 판정에서 제외한다.
## 4. 게임 시작 절차 (에디터)
1. `Assets/Scenes/Title.unity` 에서 Play (Lobby·InGame 씬 직접 Play 는 초기화가 없어 진행되지 않는다).
2. `MainToTitle` 이 Addressables 로 Title 프리팹 9종을 로드 → `TitleInfo` 가 테이블 로딩 후 `TestID` 입력칸 + `btn_login` 표시 → 버튼을 눌러야 로그인(라이브 `CD90A` → 버전 9.9.9 = dev → `D1149` 재로그인 → CloudScript `Get_UserInfo`).
3. "화면을 터치해 주세요"(localtext 124) → 클릭 → `SceneManager.LoadScene("Ingame")``SceneInfo.Load_AddScene` 이 로비 맵을 Additive 로드.
- 서버 의존 = PlayFab 타이틀·CloudScript(rev 612 · 소스 `Assets/PlayFabEditorExtensions/Editor/Resources/.CloudScript.js`) · 채팅·로그·쿠폰 서버 URL 은 TitleData `ServerStatus` — 이전 개발자 자산이라 론칭 전 교체 대상.
- 🔴 진단으로 `Save_LoginToken` 을 호출하지 말 것 — `CurToken` 이 바뀌면 PD 의 실행 중 세션이 「중복 로그인」(localtext 139)으로 종료된다. 읽기 전용 확인은 `LoginWithCustomID(CreateAccount:false)` + `GetTitleData` 까지만.
## 5. Play 제어·관찰
```powershell
unity command editor_play # / editor_pause / editor_stop
unity command capture_game_view --save_path Screenshots_WL/<이름>.png --source screen
unity command get_scene_hierarchy
unity command find_gameobjects --type <타입명>
```
## 6. 커스텀 명령
- 아직 없음. 구 WL 레포의 `wl_info`·`wl_timescale`·`wl_teleport_player`(`[CliCommand]` 정적 메서드) 패턴을 이 프로젝트의 `Actor`/`PCInfo` 에 맞춰 이식하는 것이 다음 단계. 데이터 값은 코드 상수로 두지 말고 테이블·설정 에셋을 읽는다(C45).
## 7. 커스텀 인터페이스 (HTTP + JSON)
- 서버 API = `http://127.0.0.1:<port>/api/{status, commands, exec, progress, dialog, job}` · 헤더 `Authorization: Bearer <evalToken>` (포트·토큰 = `Library/Pipeline/.unity-pipeline-port`).
- 클라이언트 = `Tools/Pipeline/pipeline_client.py` (표준 라이브러리만 · `python Tools/Pipeline/pipeline_client.py serve` → 브라우저 제어판 127.0.0.1:7700).
## 8. 커밋·기록
- 브랜치 `wl/unity6-upgrade` 에서 작업. 커밋은 PD 확인 후 파일 지정으로만. `Library/`·`Temp/`·`.unity-pipeline-runtime-port`·`Screenshots_WL/` 는 미추적.
- 에디터가 자동으로 고치는 파일(`PlayFabEditorPrefsSO.asset`·`GvhProjectSettings.xml`·URP 업그레이드로 재직렬화된 `.mat`)은 AI 변경이 아니다 — 커밋 여부는 PD 결정.
- 작업 결과·교훈은 NerdNavisAi 레포 `공유/대화로그/WL프로젝트/``profile-wl` 교훈 인덱스에 남긴다.