Run function on blueprint game instance from C++ class

I am create custom console commands using C++. All the logic is within a blueprint game instance. How could i find and call these functions within C++

Hi @Sam_Carey. I have never seen a way to do this… mainly because the blueprint logic doesn’t exist during C++ compile time. However, you can create a BlueprintNativeEvent or broadcast a delegate as a BlueprintAssignableEvent and assign the logic in the blueprint to that delegate

In this scenario, I would use a blueprint native event. That way, you can have the native implementation throw a log to the console output in case you forget to override it in your blueprint class. To override the function in your blueprint, just go to the overrides drop down and select your event.

Have fun

It is almost always a good idea to have c++ parents for core gameplay classes such as game mode, game state, player controller etc. including game instance, where you can write some heavy methods or expose c+±only features to blueprints. I suggest you create base c++ game instance and move necessary methods there.

Otherwise, you cannot directly call anything from bp in c++ but you can use delegates. However, this approach is a bit messier for project architecture

I have tried your suggestion, however I am receiving some strange errors. Would you have any what is causing this?

When you define BlueprintNativeEvents in C++, the name of the event is going to be OriginalName_Implementation. Event with OriginalName is already present but is only for Blueprints, that’s why you get this error.