Make Unreal REAL.
article thumbnail

월드에서 무언가를 가져오는 함수를 실행할 때 UObject* 타입의 WorldContextObject라는 인자를 자주 본 적이 있을 것이다.

 

 

[C++] WorldContextObject Parameter

Hi, I’m trying to set the world’s time dilation, but I’m having an issue with one of the parameters it wants. Here’s the function declaration inside GameplayStatistics: static void SetGlobalTimeDilation(UObject* WorldContextObject, float TimeDilati

forums.unrealengine.com

 

포럼에 따르면 이 인자는 GetWorld() 함수를 실행해 월드를 가져올 수 있는 오브젝트면 아무 것이나 가능하다고 한다.

 

따라서, Pawn 등에서 this를 전달해도 된다.

  • APawn::GetWorld() 함수가 존재하기 때문이다.

 

GetWorld()를 함수로 월드를 전달하는 것이 보통인데 심지어는 이런 것도 가능하다.

  • UWorld::GetWorld() 함수도 존재하기 때문이다.

 

 

내부를 살펴보면 실제로 WorldContextObject->GetWorld()를 통해 월드를 가져온다.

 

profile

Make Unreal REAL.

@diesuki4

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!

검색 태그