Download

simple question about events.

i dont think i know the proper terminology to google this but i just keep getting not good answers.

i have an actor. the actor dynamically creates several instanced static meshes at runtime.

i need each ISM to have an on click event.

the problem is i need the ISM’s to have said event to be called in a different blueprint.

Is this done with casting? if so how exactly is it set up.

Do they have to be ISMs?

picture of things

why does it matter if they are isms or not?

Look into dispatchers, and blueprint interfaces. Blueprints are kind of hopeless with between actors communication.
So i always make global dispatcher that is in game mode (or something else easily accessed) that can be called and executed to dispatch “global” events.
Then everything that needs communication with more than one “hoop” to get trough uses that dispatcher.
Dispatcher sends structure that is for eg.: “sender name”, “message name”, “message value”, all as string (or text).
Works really well for UMG (where communication up and down is total mess), done that for damage system (yes unreal has build in, but my code i can easily change). etc.
And then Blueprint Interfaces allow you to call events (or functions) to objects you do not know what class they are.

And last trick (but sometimes it is not worth trouble) is making blueprintable components that have that dispatcher plus blueprintable interface codded in. So you have all communication is small container that you can just drag and drop on actors, or add as component. There is one problem with them though, you need to make more platter code, so they recognize all possible parent classes and know how to act.

so i put a call eventdispatcher in the ISM actor and bind the event dispatcher to an event in the other actor.

i figured out the problem with isms. or at least i cant find a way to pass the individual instance reference on an onclick event. as the on click event itself targets the entire ism component.

so anyone got a workaround for this. in the learning project im making its not a big deal to use actors over ism’s. but my future project would benefit alot from isms.