Ok, got this working so here is an example....
I want to call a blueprint function from C++.
So first I make a blueprint function called CallFunctionTest. (In our game, and we call a player a "Survivor".) It just prints "Survivor Call Function Test" in pink on the console.
Then I have a static blueprint set of functions like this...
The header file is
- #include "Kismet/BlueprintFunctionLibrary.h"
-
- #include "TDLSurvivorFastCache.generated.h"
-
- /**
- *
- */
- UCLASS()
- class TDL_API UTDLSurvivorFastCache : public UBlueprintFunctionLibrary
- {
- GENERATED_UCLASS_BODY()
-
-
- public:
-
- UFUNCTION(BlueprintCallable, Category = TDLSurvivorCache)
- static void TestCPPCallToBP(AActor * c);
-
- };
-
and the cpp file is...
- #include "tdl.h"
- #include "ConsoleManager.h"
-
- #include "TDLSurvivorFastCache.h"
-
- UTDLSurvivorFastCache::UTDLSurvivorFastCache(const class FObjectInitializer & PCIP)
- : Super(PCIP)
- {
- UE_LOG(TDLLog, Log, TEXT("UTDLSurvivorFastCache"));
- }
-
- void UTDLSurvivorFastCache::TestCPPCallToBP(AActor * c)
- {
- FOutputDeviceNull ar;
- c->CallFunctionByNameWithArguments(TEXT("CallFunctionTest"), ar, NULL, true);
- }
-
Then we call the test function from our SurvivorBP blueprint and it calls the function on the SurvivorBP.
Here are the blueprints
https://answers.unrealengine.com/questions/116529/call-blueprint-functions-from-c.html?sort=oldest
반응형
'게임엔진(GameEngine) > Unreal4' 카테고리의 다른 글
언리얼4 Blueprint 에서 unit64 사용하기 (0) | 2016.07.08 |
---|---|
C++에서 블루프린트 함수 호출하기 .2 인자와 같이 넘기기 (0) | 2016.07.08 |
c++ 에서 블루프린트 이벤트 호출하기 (0) | 2016.07.08 |
델리게이트 (Delegate) (0) | 2016.07.07 |
UGameInstance, 싱글톤 생성 부모 클래스 (0) | 2016.07.06 |