I have a c++ project and i want to create a pause menu, the thing is i wan to call that menu in blueprints because it feels more organized and is way less messy in general.
The thing is in a C++ project you dont have acess to your character ,Character controller and Hud Blueprints so the question is. Where can i put the menu logic if i dont have acess to those blueprints?
P.S: i already have the main menu wich i simply call from the level blueprint but i cant do that in the pause menu because the pause menu must be acessible in all levels and copying the pause menu logic to all level is not the best option.
Your question kind of confuse me, what you mean u don’t have access to your character, character controller. Is what u mean it you don’t have c++ class for your character or controller, and you create your character or controller on default Character or controller in blueprint ?
*EDIT: one more thing u use Slate or UMG for your UI ?
Blueprint are valid classes same as C++ and they can actully interact, it’s easy for Blueprint to C++ but theres also ways to for C++ to Blueprint
C++ compiler only see what is written in C++, so in order to call something in blueprint from C++ you need this point of attachment in between C++ and blueprint and best for that are events. So create base class C++ with events (which are normal function with BlueprintImplementableEvent specifier in UFUNCTION) you want to call in blueprint and then make blueprint based of that C++ class, now when you gonna try to access character or controller if you used that blueprint based on C++ with events you can cast that class to that base class and call those events… this will trigger events in blueprint allowing to execute blueprint code
Simple way is you can create a player controller or character blueprint, then in code where you press button to display menu make a UFUNCTION(BlueprintImplementableEvent) then call it, in blueprint this function will be trigger then you just need to create your widget at that moment, same when you want to turn off.
Any chance you can make a tutorial with pictures and some code? or maby just point to some one elses tut. Im kinda lost and dont know what to search for.
then i created a blueprint with the event but when i press P wich is the key bound to “Pause” nothing hapens. The event is not being fire and i have no clue why.
Right now my blue print is simply the event linked to a print string node.
I managed to figure it out myself, i had to set my character to the blueprint character in my gamemode class in c++, then the events fired and i could use BlueprintImplementableEvents.