Class Blueprint Event to happend in level blueprint [Need answer!]

I have a 2D sprite button. The picture is the event when I press the button. I want this touch event to get called in the level blueprint. I want this because I have some stuff happening in my level blueprint and I need to call them from the button chick. How can I do that? I’d really appreciate an answer!

51991-help.png

If you can get a reference in the levelblueprint to the Actor that contains the SpriteComponent, then you just need to bind OnInputTouchBegin to an event:

Probably bind it in the BeginPlay event.

Thanks for answering. It didn’t work form me. Is it because the sprite/button is inside my character blueprint?

Here you can see what I did. Am I doing something wrong? @Ghar

it should work. Is MyCharacter valid at that point?

What do you mean by valid? But well, I anyways think he is valid. If I do the event in my character blueprint, It does work. So it should work in the level blueprint. Hmmmm…

52114-help3.png

The MyCharacter Variable might be NULL at that point. You can place an IsValid node to check, or use a breakpoint.

IsValid node:

If it’s invalid you have to Set it somehow before binding the Event. if MyCharacter is your PlayerCharacter, it could be done by getting the PlayerCharacter and casting it to your Character class, and using that to assign it to your variable. Then you can bind the Event:

I checked and it was not valid. So I did what you said and it worked! Thanks for the help! :slight_smile:

No problem :slight_smile: