Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

alt text

Product Version: UE 4.8
help.png (21.2 kB)
more ▼

asked Jul 29 '15 at 11:47 PM in Blueprint Scripting

avatar image

22 3 6 9

avatar image Ghar Jul 30 '15 at 02:43 AM

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:

alt text

Probably bind it in the BeginPlay event.

avatar image Traczy Jul 30 '15 at 03:30 PM

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

alt text

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

help2.png (84.6 kB)
avatar image Ghar Jul 30 '15 at 03:32 PM

it should work. Is MyCharacter valid at that point?

avatar image Traczy Jul 30 '15 at 03:47 PM

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..alt text

help3.png (31.6 kB)
avatar image Ghar Jul 30 '15 at 03:57 PM

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

IsValid node: alt text

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: alt text

avatar image Traczy Jul 30 '15 at 04:06 PM

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

avatar image Ghar Jul 30 '15 at 04:35 PM

No problem :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question