In my level blueprint i have boolean variables, i need to know when they are true, so i toggle the visibility of an image in my HUD. https://www.youtube.com/watch?v=p0LF5NgE000&t=248s I followed this tutorial, at 3:33 he puts a “cast to ThirdPersonCharacter” to get the variables in it, but i don’t know what is the name of the function that calls the level blueprint and gets his variables, can you help me?
Create first node "Get player character. Then drag out blue pin right click and start typing name of your character blueprint.
As to name of function in level blueprint: (and variables): you create them so you name them.
Also post pictures of your bvlueprint code, hard to guess without it.
Here’s my situation, the first image is inside “add bind” of the image, the second one is the level blueprint with the boolean variable “boat1” and the third one is the image that has to disappear and appear (boat1 false-true)
Looks like you either missed part of tutorial or you are trying to make something slightly different from tutorial.
Problem with level blueprint is that nothing can reference it from outside (At least i did not find a way) so nothing can read variables FROM level blueprint. But instead level blueprint can PLACE its variables into about any actor.
To make communication from level blueprint up to player UMG (Hud):
- make BOOLEAN variable inside player controller, call it “IsWidgetVisible?”
- in level blueprint after you set “Boat 1” value add “get player controller” and “cast to controller you are using” then set “IsWidgetVisible” to true or false
Now your level blueprint tells your player what value visibility has. Time to get it into widget.
- in your widget blueprint (not inside function get Visibliety), but in blueprint “CambioLivello”
- you have “Event tick” ther (or create one if you do not).
- on event tick: get player controller, then cast to your player controller blueprint,
- then from blue pin drag line and write “IsWidgetVisible?” you should get node that read that variable,
- save that variable to new one created in widget blueprint
- then in getvisibility use that variable to set visibility result
I understand what your trying to do, pass the information of the boolean through the character blueprint, but when i compile i get this “Cast to ghost_bp would always fail” (ghost_bp is my character blueprint) how can i fix that?
Character Blueprint is PAWN, for it to work you need get player pawn
Probably You also have Player Controller blueprint somewhere.
Get Player controller >> you can cast to Controller type blueprint
Get Player Pawn >> you can cast to player character blueprint
Ps error code says exactly that. Look what class “Ghost_Bp” inherits from.
Also it is nice to have some naming convention for your blueprints.
For eg I am always naming my blueprints like this: BP_Ghost_Controller, BP_Ghost_Character etc.
When i want cast to any of my bps i write BP_ and i get list of all of my blueprints
When i need PAWN i just write _pawn or _Character etc.
That helps a lot.
Ok man i figure it out, now it works, thank you so much. I didn’t need to place the “IsWidgetVisible?” in a new boolean variable, it works also without it. I post the image of the level blueprint and the binding below, maybe it can be helpful to someone else