I have a Widget with a button on it. When I click the button I would like to run a Custom Event from the “Blueprint_Test” class. But I have no idea what to put in the target.
Normally I would create a public variable of “Blueprint_Test” in my Menu Widget.
But then I get a “Accesed None” error. Becouse I have to assign the Blueprint_Test to the variable in the “Details” panel of the object. But since this is a Widget it is not placed in the scene. It is created in the scene via a different object with the “Create Widget” node. So I can not drag Blueprint_Test in to the variable.
It is probarly something very easy but it can take me days to solve this.
It is just for some prototyping. I have a Unity background and worked with Unity Visual Scripting. I am trying to transfer from Unity in to Unreal. And I am trying some communication between different elements.
thank you for the fast repsonse and clear explenation. I see that in Unreal Engine a lot of stuff is done in the Level Blueprint. In Unity I try to keep things seperated as much as possible. For example: UI_Manger, Audio_Manager, Input_Manager, Score_Manager etc etc…
This kind of stuff is mostly done in the level blueprint?
I see that in Unreal Engine a lot of stuff is done in the Level Blueprint. […]
This kind of stuff is mostly done in the level blueprint?
On the contrary, ideally you’d never use it. But since you’ve placed your actors in the scene… that’s the easiest way to go about it. Level Blueprint has its uses. If you want to tie some mechanics to one level and one level only, you can then use its blueprint.
You can create a complex project without ever opening the LB.
UE4 has a framework, a bunch of dependant classes:
These are the places where one can create and reference manager actors. Framework is accessible from (almost) anywhere.
Casting is great, and inheritance is indispensable.
Interface: you’ve got a reference but you do not know the class, think projectile hitting something, anything:
We’ll send the target a message, if they implement the interface and have the functionality, they can deal with the message any way they want. Casting still happens here but it’s hidden under the hood.
Event Dispatchers: you have the reference now, but want talk to the actor later, or want the delegate sent to another actor:
You will need all of them, use all of them, often together. They’re circumstantial and situational. None is better than the other. You choose the best tool for the job.
I would actually like to create this outside the level blueprint.
First example above. Direct comms. No casting, no level blueprint. One to one chit chat.
Widget buttons have a bunch of dispatchers already (so do other widgets and actors). Widget talks to the UI manager through a dispatcher and the UI manager directly asks the Test Actor instance to rotate.
I am going to take some time to look at your post and experiment with it myself.
I have to give props for the Unreal Forum feedback time. Have posted more questions last week and all of them were answered quite fast.