• [Unreal 게시판] C++에서 blue print로 custom event 호출하기2014.08.01 PM 05:11

게시물 주소 FONT글자 작게하기 글자 키우기

Question>

UE4의 PlayerTick() 함수 내에서
'GetLevel()->GetLevels!cripBlueprint()->..' 이런식으로 접근해 호출 하려는데 잘모르겠네요.

https://docs.unrealengine.com/latest/KOR/Engine/Blueprints/UserGuide/Events/Custom/index.html

콘솔명령어를 이용거나 RemoteEvent 노드를 이용하라는데 어떻게 사용하는 건지 모르겠고요.
이렇게 하는게 맞는건지 아니면 c++ 에서 레벨블루프린트의 이벤트를 호출하려는 것부터가
UE4 의도에 맞는건지 궁금합니다.

-------------------------------------------------------------

Answer>

custom event에 대해서는 언급하신 link에 자세히 나와 있고요.

https://docs.unrealengine.com/latest/KOR/Engine/Blueprints/UserGuide/Events/Custom/index.html

그런데,
link 내용에 C++에 blue print로 호출하는 방법에 대해서,
너무 간단하게 나와서, 처음 보시는 분들은 당황할 수 있겠네요.^^;;;;;;


님이 만드신 blue print의 cumstom event 이름 'YourCustomEvent'라면,
C++에서 아래와 같이 호출할 수 있습니다.


void AYourPlayerController::YourFunction()
{
ConsoleCommand( TEXT( "CE YourCustomEvent" ) );
}


위 source의 AYourPlayerController는 APlayerController를
상속해서 님이 만든 class고요. YourFunction() 역시 님이 만든 함수 입니다.


그런데,
ConsoleCommand()를 이용해서 blue print에 event를 발생시키는 건,
unreal engine 3에서 쓰던 방법이라서리..^^;;;;;
unreal engine 4로 구현한다면,
좀 더 효율적인 방법을 쓰는게 더 좋습니다.


https://wiki.unrealengine.com/Blueprints,_Empower_Your_Entire_Team_With_BlueprintImplementableEvent
https://answers.unrealengine.com/questions/57955/return-a-value-from-a-blueprintimplementableevent.html


'BlueprintImplementableEvent'를 쓰는 게 좋은 이유는
link 내용에서 알 수 있듯이 parameter 전달이나 return 값의 전달이
ConsoleCommand()를 쓰는 거 보다 훨~씬~ 자연스럽기 때문입니다.
( ConsoleCommand()도 가능하지만, source가 상~당~히~ 지저분해집니다.^^;;;;;; )
주변의 C++ source와도 자연스럽게 융합되기 때문에 눈에 거슬리지도 않고요.


따라서,
'일방적인 명령'에 중심을 둔다면,
ConsoleCommand()의 'CE'를 사용하시고요.^^;;;;;;;
'parameter와 return 값으로 소통'에 중심을 둔다면,
'BlueprintImplementableEvent'를 사용하시기 바랍니다.^^







Tag:
안기훈, Kee Hoon Ahn, 언리얼, Unreal, UDK, iPhone, iPad, app, 앱, iOS
댓글 : 0 개
친구글 비밀글 댓글 쓰기