Why is a Blueprint node somewhere available and somewhere not? I wanted to create blueprint that would work like a game menu manager - with functions for opening and closing menu screens (as HUD widgets) etc. When menu screen is shown, then manager should pause the game and show mouse cursor. I made my blueprint parented to Object, because I wanted nothing more from it.
However, I found that SetGamePaused node is not available in any function of the manager blueprint. I tried to create blueprint function library (which could use SetGamePaused) with function MySetGamePaused working as simple wrapper for the node, however neither this function was available as node in the manager blueprint. When I reparented blueprint to Actor, suddenly SetGamePaused was there. But why? I thought the node is something like “global”, and can be used from anywhere.
What nodes are available depends on their inheritance hierarchy so different blueprints have access to different functions. SetGamePaused is defined in GameplayStatics, which inherits from Object, so if you use object as your parent class, you don’t have access to it. You can’t access FunctionLibraries for essentially the same reason. Object is the base class.
Why are you using Object as your parent class? Note that Object can not be placed directly in a level like an actor can. How are you accessing your manager?
Well, idea was to have instance of my manager blueprint in a variable of my custom GameInstance. Whenever i would want to show menu, i would get the variable and use manager’s function like ShowMenu. So the manager itself should be nothing visual, it will never be placed on scene for example. Object as based class seemed enough for me.
So, what is the least “expensive” parent that supports SetGamePaused? I cannot choose GameplayStatics as parent when creating new blueprint.
In fact, in the end I decided to put MenuShow and similar functions directly to my GameInstance (which works). But it is not the structure that I had on my mind in the begining, so I ask to learn where it was flawed.
I had also wanted to do something similar before and I had to place the manager object as an actor in world in order to use it. I believe this has changed as of 4.9, and you can use Construct Object from Class node. But it still won’t do what you want, as it will be an object and won’t be able to access what you need. I’m not sure of a good way to do that. Even though it doesn’t “need” to be an actor, I wouldn’t say it’s expensive. I spawned my manager actor on begin play in gamemode so it would be persistent across level loads for example, you can also access it from other actors with get game mode, though I have also put my pause function in GameInstance, and loading screen handling. mayb somone else will know a better way of doing it, but from my understanding, in blueprints, it would have to be an actor.
I could probably do it in my way with c++, but I started with blueprints and I don’t want to learn unreal c++ programing now. Ok, thanks for info and ideas