Forum rules - please read before posting.

Unity UI - Mouse Over and Custom Animation

Lets say I have a top bar that I want to have show when the mouse is over its area. It will also perform a custom animation of appearing and disappearing. I setup the animation controller like the example one given.

In order for my animations to work properly I need to include a transition time >= the animations time. So for the sake of this example lets say my transition time is 2 seconds. So I play a 2 second appearing animation and a 2 second disappearing animation.

1. I move the cursor to the area, it appears. (DoTransition: True, On trigger: true). On is consumed to false.

2. I move the cursor off the area and thus (DoTransition: True and Off trigger is true). Off is consumed to false.

3. Thus my animation is playing to disappear and before the 2 second transition is up I move my mouse back into the area. What seems to happen in this case is when the 2 second transition is up, I get triggers set to true for both Off and On. Since I am in the Off state, it runs the On state (On trigger consumed to false) and then immediately after runs Off state (Off trigger consumed to false). The end result is the mouse is in the area for the menu to show yet it is in the Off state.

I hope I explained this well enough. If not I think I would need to make a video to show this.

Comments

  • I follow, but I'd appreciate a zip of the Menu Manager/Prefab/Controller/Animations rather than a video - that way I'll have exactly the same setup as you.
  • http://wikisend.com/download/502212/UITest.zip

    Here you go. Its made from a fresh package import of AC 1.41a. A fresh new game wizard of unity ui. I made a simple Canvas with a panel that fades in and out for 1 second. I use the controller you provide as an example for Unity UI custom animation transitions. menu manager has a transition time of 1 to match the animation time. Repeat the steps above to emulate the problem.
  • Thanks, I'll look into it.
  • Fixed.  From now on, Animators on Unity UI controllers will work by calling specific state names (e.g. "On", "OffInstant") rather than relying on parameters.  This will allow animations to play mid-way through, in the case that you want to turn off a menu mid-way through it fading in.
  • Thanks Chris, will this be in 1.41c?

    I assume the ability to turn off a menu mid-way would be with setting the transition time < the animation time?
  • edited January 2015
    Also if you wanted it to use parameters I believe you still could if you got rid of using triggers and instead set "DoTransition" and one other bool "On" through the various states.
  • I'm not fussed - I've update the example controller, and it works.  Yes, it sets the normalized time of the animation, so that it can "cancel" a transition in.

    Will be in 1.42.
  • Thanks for your assistance on this. I'll be looking forward to the update.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.