x

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"

UMG single animation for multiple widgets

Hello,

I'm wondering, is there a way to apply a single animation to be used for multiple widgets? For example, have a single animation called 'ButtonHover' that can be used for all the buttons in a menu when a mouse is hovered on each? I am asking this because I have a menu with a large amount of buttons that look the same, but rather than having a seperate animation for every single one of those identical buttons, I would like to have a single animation to be called for each button when required. More specifically, the text within those buttons must also have a single animation to share and use when needed, perhaps in the same animation as its parent button animation.

Thanks in advance!

Product Version: UE 4.12
Tags:
more ▼

asked Jul 20 '16 at 07:54 AM in Blueprint Scripting

avatar image

TornadoStorm
102 19 20 24

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

2 answers: sort voted first

What Atheist91 is saying is exactly correct, let me clarify.
What you want is to nest one User Widget (in this case, an editable button widget with an animation) inside of another User Widget (which I have set up as a canvas for the purposes of this example). So lets go through this step by step.

First we will make the button widget, it can be simple with about 2 elements for the sake of this example. It also has a custom animation that basically just changes the scale of the button when played. You should note that we are using custom size for this widget as shown at the top right of the screen.
alt text
Next we will bind the onhovered event to play my animation for this button.
alt text
Once that widget is done we will make a new widget, this time we place a vertical box with 4 of our button widgets inside of a much larger canvas widget. In this way, if we hover over any of our buttons, they will play back the same animation. Each button is editable per instance with a basic interface right now, but if you wanted to expose more variables from the base class for instance editing you could.
alt text
Also, if you want to find your widgets faster, you can use the handy search box.
alt text
I hope this helps with your awesome project!
-Spiris

more ▼

answered Aug 10 '16 at 04:58 AM

avatar image

Spiris
1.1k 41 33 76

avatar image TornadoStorm Aug 10 '16 at 07:14 AM

Yes! Thanks for the explanation. The other guy didn't seem to do very well with his answer, although I'm sure he meant the same thing. This helped a lot! Now I can have a very polished menu :)

avatar image Atheist91 Aug 10 '16 at 07:14 AM

Yeah, that's what I meant. Thanks Spiris. ^^

avatar image TornadoStorm Aug 10 '16 at 09:23 AM

A few questions on that though, how can I set its custom text? Through a public binding? And how do I assign an OnClicked event for the individual buttons? It doesn't seem to show when I place it in another blueprint

avatar image Atheist91 Aug 10 '16 at 01:48 PM

As for text, a simple Text variable would do (and then set it in construct node). The variable would have to be public and 'editable'.

As for OnClicked event, you'd have to create your own event that is fired whenever the actuall OnClicked event is fired. Event dispatcher is what you need here.

avatar image TornadoStorm Aug 10 '16 at 04:26 PM

Alright, thank you! I'll go learn how to use Event Dispatchers. Hopefully they do exactly what I want them to do :D

avatar image Atheist91 Aug 10 '16 at 06:13 PM

Here's example of how to setup what i was talking about.

Your custom button widget - UI side: alt text

Custom button widget - variable for display text: alt text

Changing text on your button using your variable: alt text

Customizing text on button (won't show up in editor): alt text

Event dispatcher setup: alt text

The OnPressed(Button_Button) event is just an event you can hook up to on any vanilla UE4 button widget.

avatar image TornadoStorm Aug 10 '16 at 06:46 PM

Great! Thanks again, you went the extra mile :D really appreciate the help.

avatar image Sheffield49 Aug 10 '16 at 01:36 PM

I share Tornado's excitement, many thanks!

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

If you made a custom widget for your button, then you can make the animation in that button's widget. Then obviously all these buttons would be able to use that animation.

I don't think there's a way to do it other way.

more ▼

answered Jul 20 '16 at 08:02 AM

avatar image

Atheist91
1.2k 20 23 40

avatar image TornadoStorm Jul 20 '16 at 05:25 PM

What do you mean by this? It doesn't seem to apply to all my buttons. Can you provide an image of what you mean?

avatar image Atheist91 Aug 10 '16 at 07:14 AM

Sorry TornadoStorm, I didn't see your comment until yesterday when Sheffield49 wrote his comment. Was going to make some example today in the evening but I guess it won't be needed anymore. :p

avatar image TornadoStorm Aug 10 '16 at 07:41 AM

No problem! :D

avatar image Sheffield49 Aug 09 '16 at 10:00 PM

Just to add to this, I'm having the same issue. I might have 12 buttons in one widget and I want all of them to play a rather complex fade-in animation when loaded. Anyone's assistance with this would be awesome!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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