Still stuck unfortunately, how do I get a widget button to toggle the visibility of an object?
I tried it with a light, the key press F works, the button still doesnāt.
Starting to think itās not possible use input from a Widget Blueprint somewhere outside of that blueprintā¦
Another weekend spend for nothing great !..
You will need to cast to that object, get mesh, then set visibility. That should work. I can make an example or show you an example from something I use later when I get back home.
Just at a glance, you need to make sure to check the box next to āKlikā on your Set Klik boolean node after the cast node in your second screenshot. Right now the boolean is getting set to āfalseā on click, so even if everything else is set up correctly, the event tick is going to travel down the āFalseā half of your branch in the first screenshot.
Thanks will give it a shot later, donāt think thats the only issue. When I run the level with logging on I see the ācast to muur_blueprintā fail for some reason.
It will fail, you have no reference of an object going into the castā¦
What are you trying to achieve? Looking at something, clicking and making it disappear? If so you could raytrace to it and on the hit output is equal to what you want, going into a branch which then casts to the class that has the kik thing in, set to true (ticked).
I want a button (from the widget blueprint) to toggle the visibility of an object.
The reference part I donāt really get , Iāve tried to create a var. from a scene object and wired that into the Cast To Object slot but no luck so far.
What is confusing to me is why it needs a reference in the first place. The blueprint I cast to is from a mesh object already.
Hi Cultor,
I have the same problem āChange visibility mesh object with Widget buttonā 14 days and still nothing , I do not understand it If you come up with something, I would be really helpful.
Hello,
Instead of a reference, which need to be set with the specific actor in the level you want to interact with. (On event begin play for example), do a āget all actorsā selecting your blueprint in āactor classā. If you have only one actor of this class, drag a āgetā from it and drag your bool from it (donāt forget to check your bool) If you have more than one actor, you will need to use a tag to know which actor activate : https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/FindingActors/Blueprints/index.html
I double post to show you the 2 possibilities :
1 in level blueprint : You create your widget and you immediatly āsetā your reference with the blueprint ( selected in level and right click to have it in level blueprint) then in widget, you use the reference filld and drag your mesh (cube in my example) to set its visibility. (i used a custom event named āevent clickā but this is the click button event as the one under)
2 in widget only : You get all actors of this type of blueprint and get it (because there is only one. if there was more, i would have do a for each loop and cehck the one i want to use)
Thanks a lot Fen, managed to get your second method to work! Will give the first one a go tomorrow which seems a bit more complicated.
Not quite sure Iām completely understanding why it works without all the casting / direct communication but itās great to see something happen now
@DSursely
Thanks for the tip will look into that. The only place Iām using the Get Player Controller now is in the level blueprint to enable the mouse to click the button
Hi Fen ,
Thank you very much, second method works for me.
My problem was : 1. Get all actorsā¦box 2. minimal blueprint on static mesh -for show in list/