Scriptable Object를 사용한 플레이어 위치 제어

2024. 7. 14. 05:14Unity

기본 로직

1. 플레이어의 위치를 저장할 ScriptableObject를 생성한다.

2. PlayerController 스크립트에서 플레이어의 위치를 ScriptableObejct에 저장하고, 씬 전환 후 해당 위치로 이동시킨다.

3. 해당 기능을 작동시키는 트리거를 설정한다

 

 

참고문헌

Unity에서도 장면 간 데이터를 유지하는 방법으로 Scriptable Object를 사용하는것을 제안한다고 한다.

유니티 내 커뮤니티 게시판에서의 대화를 참고했다.

플레이어 위치 뿐 아니라 상태값, 즉 체력 등 또한 관리할 수 있을 것 같다.

https://forum.unity.com/threads/scriptable-objects-pattern-for-players-position.1008790/

 

Scriptable Objects pattern for player's position

I've just watched the "Game Architecture with Scriptable Objects" Unite talk 2017. In my game, a lot of time I just need the position of the player so...

forum.unity.com

 

 

 

'Unity' 카테고리의 다른 글

[UI] 스크롤뷰(Scroll View)에 관하여  (0) 2024.10.14