Download

Why can't I call an event or function in another blueprint?

I have a UMG widget that is created from within MyCharacter. When it has a certain button clicked, it is supposed to have the Character change the material of a selected object. I can’t for the life of me get the character to receive any called event dispatches. I’ve tried to put it inside a function and call the function, I’ve called the “event” part of the dispatch, as well as just the dispatch, and I still don’t know the difference.

da1e527c8db20db28477a7c2dfbc3da84b7a3ad2.jpeg

Widget_Dispatch.JPG

Edit: I can’t figure out how to remove that second image of calling the event.

Hello,
maybe it doesn’t recognize the character. Have you try “get player character” / cast to “mycharacter” then drag your function from the cast ?

edit : i wrote get player controller. My bad…

Event dispatch only work within a class Parent/Child, & Level blueprint as far as I know.

See document here:
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/index.html

From the document page
*Event Dispatchers

By binding one or more events to an Event Dispatcher, you can cause all of those events to fire once the Event Dispatcher is called. These events can be bound within a Class Blueprint, but Event Dispatchers also allow events to be fired within the Level Blueprint.*

Between classes, you probably need to use either casting or Blueprint Interface.

Aha, that is definitely something worth knowing. I always felt like Blueprints wouldn’t let you try something that strictly doesn’t work, but I keep running into these gaps in my knowledge and Blueprints doesn’t warn me. Thanks!

That did the trick! Thank you, I didn’t know that “get player character” existed.

Its normal (at least for me). Alots of time, you do not know something works/or not work unless someone pointed out, or you seen in a tutorial online.

Blueprint learning structure could be improved.

An improvement could be when you try to put something into a graph by typing its name. When it is not allowed, instead of not showing, it can be grayed out (with a useful tip that it is not allowed). That would have saved a lot of headache.

Hey StephaBon,

You did a wrong way(In you case: SetWoodMaterial is a Event Dispatcher, not your custom Event), and you didn’t do a binding, so the Event Dispatchers did not work.

In My case:

  1. Create a Event Dispatcher in your widget blueprint, and a custom event in your character.
  2. Bind the custom event to the event dispatcher of your UMG widget.
    3.In your UMG widget button clicke event call the event dispatcher. that’s it:
    2d0f15b9f291b05d2d65a3be6dd2ddc4bc5b4321.jpeg
    993ad5955b15d73f3b7dff4b747282f900c0a733.jpeg

Dang it! Yeah this was my first attempt at trying the dispatcher, and I hadn’t thoroughly read the documentation. Binding stuff is what always gets me. Thanks for your help