Client/Unity

Unity) CharacterController에서 transform.position이 작동하지 않을 때

Juzdalua 2024. 5. 10. 00:07

캐릭터의 순간이동(포탈이동)이 되지 않는 문제.

# 캐릭터컨트롤러는 계속해서 position을 정의하기 때문에(?) 임의로 위치변경을 할 수 없다.

 

해결방법)

비활성화했다가 이동하고 풀어주기

interactorTransform.GetComponent<CharacterController>().enabled = false;
interactorTransform.position = destination.position;
interactorTransform.GetComponent<CharacterController>().enabled = true;

 

참고)

 

Resolved - transform.position does not work

I've been trying to make my own save and load features for my game. I got everything working until the last few lines using System.Collections; using...

forum.unity.com

 

'Client > Unity' 카테고리의 다른 글

Unity) Singleton 제네릭 매니저 만들기  (0) 2024.05.24
Unity) Frame Rate 설정  (0) 2024.05.12
Unity) Input system - 이동  (0) 2024.05.04
Unity) 3인칭 캐릭터 - 이동  (0) 2024.05.02
Unity) 3인칭 캐릭터 - 카메라  (0) 2024.05.02