Hi, how i get button on clicked reference in other blueprint (character blueprint) ?
Single player or multiplayer?
Is the button in a Widget? It doesn’t matter if Singleplayer or Multiplayer, since the Widget is client side only.
So you might just create a “Custom Event” in the CharacterBlueprint, name it something like “UI Button Pressed”.
Then go to the Widget and add the “OnClicked” event of the Button. Get the “PlayerCharacter 0” and cast it to your
CharacterBlueprint. Then call the custom event.
In the Character you can now connect the custom event with the code you want to call.
Button in Widget blueprint. I create event, this work great, Big thank you ! :), beacuse i have another problem.
I cannot create connect custom event in level blueprint and widget menu blueprint. Do you now what resolve this problem ?
Goal = i click button, 80 mesh not visible in level.
Accessing the LevelBlueprint is always a bit tricky and not recommended. You could use “GetAllActorOfClass” and put in the Class of what you want to filter and get an array of these.
Then you could use that array to hide stuff. You can even do this directly in the widget. Though this will get ALL Actors of that Class, so if you only want to hide 80 of 100, then it
might not be the correct way.
Also make sure to not use that “GetAllActorsOfClass” node too often. Each button press is okay, but don’t pack it into the Event Tick or something like that.
What is best way to set visibility (hidden) 80 mesh ?. I try access to level blueprint, and my custom event not working properly.
I can bind event in menu blueprint, cannot in level blueprint… I do not know what I’m doing wrong…
To get all actors of class, you can simply use “GetAllActorsOfClass” which will return an array of the actors in your seen
based on the Class you set on that node. If you get “StateMeshActor” or something like that, you can then loop over the
array and every single one to hidden.
Also there are “get all Actors with interface”, but i still recommend you to stick with dispatchers.
Ok, i try with dispatchers, beacouse it
s not working. Level: ![levelbindevent.png|928x532](upload://oYhB229yePMezYTfh0aNAGiN2D0.png) Other blueprint: ![f4d37b5f107661935d095c16e4775c552cce6300.png|582x436](upload://yVPBf8uVc0eVDFirvxBevpf6CkM.png) Its a only one example. . I have been trying to solve this issue for several hours.
Goal: In button clicked - run blueprint in level bp
Here, Also, rewatch video about dispatchers.