Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Weird button warning

Discussion in 'Unity UI & TextMesh Pro' started by Edgaras-Randis, Feb 17, 2015.

  1. Edgaras-Randis

    Edgaras-Randis

    Joined:
    Jul 8, 2014
    Posts:
    20
    Over the last patch (4.6.2p2) it started to pop up these warnings in one scene where buttons have animator:

    Code (CSharp):
    1.  
    2. Parameter 'Normal' does not exist.
    3. UnityEngine.UI.Selectable:OnValidate()
    4.  
    5. Parameter 'Pressed' does not exist.
    6. UnityEngine.UI.Selectable:OnValidate()
    7.  
    8. Parameter 'Highlighted' does not exist.
    9. UnityEngine.UI.Selectable:OnValidate()
    10.  
    11. Parameter 'Disabled' does not exist.
    12. UnityEngine.UI.Selectable:OnValidate()
    13.  
    14. Parameter 'Normal' does not exist.
    15. UnityEngine.UI.Selectable:OnValidate()
    16.  
    Attaching a sample project for anyone else to take a look.
     

    Attached Files:

  2. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    Hmm, that sounds like either your animator has gotten messed up or become detached from your Selectable.
    Does it occur if you create a new button and generate a new animation?
     
  3. Edgaras-Randis

    Edgaras-Randis

    Joined:
    Jul 8, 2014
    Posts:
    20
    Well that's why I created a new project to test it out and it produces the same effect with test case in the first post attachment
     
  4. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    If you can replicate it, that I'd log it with the Unity Bug reporter.
     
  5. Luiz_Thiago

    Luiz_Thiago

    Joined:
    Feb 27, 2013
    Posts:
    24
    Same issue here =(
     
  6. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    541
    here too... also with last version 4.6.3
     
    menggyloid likes this.
  7. dCoding

    dCoding

    Joined:
    Sep 9, 2014
    Posts:
    26
    Same for me; Unity 4.6.3
     
    menggyloid likes this.
  8. MythralFTW

    MythralFTW

    Joined:
    Nov 25, 2014
    Posts:
    2
    Exact same issue here. It happened after updating one of my old sprites then saving.
    Started in Unity 4.6.2f1.
    Persisted after update to Unity 4.6.3.

    Created a test project and added an animator to a UI button.
    Got the following
    Code (CSharp):
    1.  
    2. Parameter 'Normal' does not exist.
    3. UnityEngine.UI.Selectable:OnValidate()
    4. Parameter 'Pressed' does not exist.
    5. UnityEngine.UI.Selectable:OnValidate()
    6. Parameter 'Highlighted' does not exist.
    7. UnityEngine.UI.Selectable:OnValidate()
    8. Parameter 'Disabled' does not exist.
    9. UnityEngine.UI.Selectable:OnValidate()
    10. Parameter 'Normal' does not exist.
    11. UnityEngine.UI.Selectable:OnValidate()
    12.  
    Edit: Submitted a bug report.
     
    Last edited: Feb 24, 2015
    menggyloid likes this.
  9. skeletromp

    skeletromp

    Joined:
    Aug 31, 2014
    Posts:
    2
    I have the same issue. It happened when I started Unity for the first time after upgrading to 4.6.3.
     
  10. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    Just tried this using the "Auto Generate Animation" and worked fine.
    Are you putting an EMPTY animation controller on a button? if so they the errors are going to be expected as the animation states the button uses cannot be found.
     
  11. MythralFTW

    MythralFTW

    Joined:
    Nov 25, 2014
    Posts:
    2
    No the animation controller is not empty, its animations still work it just gives those errors.
     
  12. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    That is so odd then @MythralFTW Tried in both U5 and 4.6.3 without issue. Very odd
     
  13. lilboylost

    lilboylost

    Joined:
    Feb 12, 2014
    Posts:
    254
    Ditto, if button have an animator component. I am seeing these warning.. What's the solution?
     
  14. JEulerium

    JEulerium

    Joined:
    Feb 18, 2014
    Posts:
    35
    Maybe ignore them? :)
     
  15. lilboylost

    lilboylost

    Joined:
    Feb 12, 2014
    Posts:
    254
    Thanks, ignoring for now :)
    I believe Button check on any animation attached to the game object is for button. Ideally, it should first check that button mode is set to Animation before evaluating attached animation.
     
  16. IndieForger

    IndieForger

    Joined:
    Dec 31, 2012
    Posts:
    42
    JEulerium is right. There is no other way but to ignore them for now until someone fix the problem.

    Simon if you want to replicate that... Create a button on the scene and change Transition option to anything. Moment you do it console will log mentioned warnings. I bet it is literally 2min fix for someone who wrote validation code but we might want to wait for that fix for a while since it is just a warning that doesn't break anything. :)
     
  17. IndieForger

    IndieForger

    Joined:
    Dec 31, 2012
    Posts:
    42
    Come to think of it... Isn't UI open-sourced? Perhaps one of us could fix ^_^
     
  18. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    Yes, you can submit a PR showing how to fix the issue on the UI source and the team will validate it and pick it up.
    Just ping @phil-Unity once done :D
     
  19. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    Right, so tried several ways and simply cannot replicate the issue, very odd. @IEvaluation @MythralFTW

    I've tried
    1. New Project, New Scene, New Button.
    2. Hit play (no error)
    3. Change Transition in Play mode (no error)
    4. Stop, change Transition (no error)
    5. Hit Play (no Error)
    AM I missing some vital step in the replication of the issue?

    I'm willing to help fix and even submit a PR for the fix to the UI project but still can't find the actual issue.
     
  20. B3aT

    B3aT

    Joined:
    Feb 12, 2014
    Posts:
    15
    This happened to me, but I have an Animator on the button, steps to reproduce in Unity5.0.0.f4 Personal

    1. new scene, new button
    2. create new animator controller (can be or not empty)
    3. attach animator component to button
    4. select the controller as controller in the animator
    5. hit play
    6. you have 6 warnings

    Parameter 'Normal' does not exist.
    UnityEngine.UI.Selectable:OnValidate(

    @SimonDarksideJ
    http://screencast.com/t/vqVraKY735
     
  21. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    If you generate a blank controler and don't use the "Auto Generate Animations" then yes you will get that error.
    The Button script expects those base states for the animation controller that is attached to a button.

    So either create the states manually or use the "Auto Generate" option. You can then modify the controller to other things past that is you wish. (Like do a different thing based on another parameter or state :D)
     
    wayofthepigeon likes this.
  22. B3aT

    B3aT

    Joined:
    Feb 12, 2014
    Posts:
    15
    Wow, makes sense after you explained it, strange are the ways of unity :), too bad the error does not explain it, and that auto generate is not on by default, when you attach it to a game object, I could not find it.
     
  23. Edgaras-Randis

    Edgaras-Randis

    Joined:
    Jul 8, 2014
    Posts:
    20
    So even if I use color tint transition with animator component I need to explicit generate those animations?
     
    Last edited: Mar 14, 2015
  24. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    541
    I disabled completely the transitions, and I use an Animator for a completely different effect when clicked, using custom states. At this point the Button component should not check at all what states are in the Animator.
     
    hessel_mm and IQpierce like this.
  25. Tom-Atom

    Tom-Atom

    Joined:
    Jun 29, 2014
    Posts:
    17
    If you want your Animator handle animations like appearing button on screen, you can also make empty RectTransform and put button as its child. With this you can animate parent as well as button inside it and without any warning or errors.
     
    thelb likes this.
  26. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    No, if you ue None, Colour tint or spriteswap, you don't need the animation controller. Only for the Animation transition
     
  27. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    No it does do an auto generate by default, in case you want to use the same animation controler for several buttons.
    I wonder if you add a controller manually, that the button script finds it and then expects it to use it regardless. Simple answer then is to not put your own controllers on a button, rather put it on a parent GO and animate child objects.
     
  28. princetrunks

    princetrunks

    Joined:
    Mar 13, 2015
    Posts:
    1
    I got these errors just now while moving an animation controller and animation clips to a UISlider that is a child of a HUD group of objects. The HUD I'm using to control the GameOver and Win screen animations and I wanted to also add in animations for changing and animating a character health meter, who's component is that UISlider I mentioned. While adding an animator controller and clips to the child slider, I got the warnings:

    1. Parameter 'Normal' does not exist.
    2. Parameter 'Pressed' does not exist.
    3. Parameter 'Highlighted' does not exist.
    4. Parameter 'Disabled' does not exist.
    I was able to fix this by changing the Transition dropdown in the Slider (Script) component to Animation...
    This opened up the NormalTrigger, Highlighted Trigger, Pressed Trigger and Disabled Trigger fields. Sure enough, in those fields were those 'Normal', Pressed', 'Highlighted' , and 'Disabled' parameters that the compiler was complaining about at runtime.

    After I erased those fields, the warnings dropped. I'm just using that slider as a Health meter and it's not Interactable. Seems that Unity will still fill in some parameters that go with the interactive functionality usually used with sliders and buttons alike, especially if you are manually adding the animations & animation controllers in like I did.

    Hope that helps :)
     
    Last edited: Mar 16, 2015
  29. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    Still seems odd. The only way I can replicate this error is by setting an interactable component to a transition state of "Animation" and have a controller with a blank animation on it.
    Setting the transition to anything else does not produce the errors.

    As the transition is implemented by the Selectable component (the base for all interactive UI components) it's the same for all of them.

    I guess I must just be missing something here. But the shortfall I can see, is that if you configure it badly, it wont work. Is that a Unity issue or a user issue?
     
  30. mcmorry

    mcmorry

    Joined:
    Dec 2, 2012
    Posts:
    541
    The error appeared after a recent upgrade of Unity. So before it was not a problem.
    Or Unity added recently the warning to tell the user to fix the problem, or it started checking also when it should not (as in my case where I have my custom animation controller, but the transition is set to none).
     
  31. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    This is something I've tried desperately to recreate @mcmorry. However unless I configure the controller really badly (remove states with the correct names in), I've been unable to replicate it.

    Even looking through the code for the Selectable (https://bitbucket.org/Unity-Technol...b/UnityEngine.UI/UI/Core/Selectable.cs?at=4.6) that controls the transition state, I cannot see how such an occurrence could happen.

    Simply because of this repeated line at all the functions that query the Animator Controller:
    Code (CSharp):
    1.             if (animator == null || !animator.enabled || !animator.isActiveAndEnabled || animator.runtimeAnimatorController == null || string.IsNullOrEmpty(triggername))
    2.                 return;
    This is called in the "TriggerAnimation" function to check an animator exists. And this function is only ever called when the Transition state is set to "Animation"

    So I'm baffled. Granted I don't work for Unity, so they may have something else to say.
     
  32. Nytro99

    Nytro99

    Joined:
    Jul 18, 2014
    Posts:
    6
    If this can help i have 2 scenes, one only for initializating and one is the main menu.
    The first scene automaticaly goes to the second.

    If i run the game from the first scene all is ok.
    If i run the game from the second scene ( the menu) i got the warnings. With all the transition options. If i remove the animator the warnings disapper.
     
  33. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    Do you have a sample project of that @Nytro99 ?
     
  34. tmkang

    tmkang

    Joined:
    Aug 1, 2014
    Posts:
    1
    I figured it out, the solution is moving the image to a child of the button
    1. (Right click button, UI>Image).
    2. Then attach the animation controller to the child.
    3. Don't forget to direct the Button Target Graphic to the child.
     
  35. JMcDougle64

    JMcDougle64

    Joined:
    Jan 16, 2015
    Posts:
    1
    princetrunks's solution worked for me. Thank you!
     
  36. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    356
    Confirmed princetrunks solution also worked for me.

    @SimonDarksideJ I added 2 animations to a slider component, show and hide animations, transition was set to color tint. Everything worked fine with no warnings, moved on and worked on other things. I closed it down for the day, then today I opened up Unity and it gave me the warnings once I pressed play. It seems to be a bug with adding animations that have nothing to do with the components state transitions. Even with transition set to none.

    Easy to produce. Add any component with states(button, slider, toggle), then add an animation to that component that moves it. Then press play.
     
  37. Non Hic

    Non Hic

    Joined:
    Feb 4, 2015
    Posts:
    95
    I added a new button (there is no auto generate animation?) and I get this error. I can't get rid of it no matter what! :mad:
     
  38. Non Hic

    Non Hic

    Joined:
    Feb 4, 2015
    Posts:
    95
    Had to recreate the button to get the "auto generate animation" button back, and then it works. On the other older button, can't add it manually. Button is useless so have to create a new button. This must be a bug! :confused:
     
  39. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,567
    The "Auto Generate Animation" button only appears if you select the transition type of "Animation"
     
  40. DaveA

    DaveA

    Joined:
    Apr 15, 2009
    Posts:
    280
    I get this in 5.0.1p2 I added a Button component to a canvas, with None as the transition and navigation, I want to be able to click anywhere on this canvas and get the pointer events (which works just fine). So there should be no animation needed, right? There's no transitions of any sort.
     
  41. piacentini

    piacentini

    Joined:
    May 27, 2014
    Posts:
    28
    This is happening for me as well, 5.0.2f1. The reason is because I have an Animator attached to the Button, but it was not auto-generated. My transition type is Color Tint btw, but I added an Animator component because the button itself needs to be animated (position, scale).
    The "fix" in this case was to simply open my Animation Controller and add four Boolean parameters to it:

    Normal
    Pressed
    Highlighted
    Disabled

    Now the validator can find these parameters (which are unused btw), and does not complain anymore.
     
  42. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    356
    You can also switch the transition to animate and make the fields blank and switch back to Color Tint.
     
  43. andrew-fray

    andrew-fray

    Joined:
    Jul 19, 2012
    Posts:
    102
    This worked for me. My repro case was a button set to transition None, but with an animator on the component doing another job. IMO unless the button's transition is Animate, we shouldn't get these warnings.
     
  44. GingerbreadFred

    GingerbreadFred

    Joined:
    Jan 27, 2014
    Posts:
    1
    Resurrecting this as I have recently hit this issue.

    Looking at the source it looks like the problem is actually arising from the call to TriggerAnimation in the OnValidate function which is totally unguarded by the transition type.

    Code (CSharp):
    1.  
    2. protected override void OnValidate()
    3. {
    4.     base.OnValidate();
    5.     m_Colors.fadeDuration = Mathf.Max(m_Colors.fadeDuration, 0.0f);
    6.  
    7.     // OnValidate can be called before OnEnable, this makes it unsafe to access other components
    8.     // since they might not have been initialized yet.
    9.     // OnSetProperty potentially access Animator or Graphics. (case 618186)
    10.     if (isActiveAndEnabled)
    11.     {
    12.         // Need to clear out the override image on the target...
    13.         DoSpriteSwap(null);
    14.  
    15.         // If the transition mode got changed, we need to clear all the transitions, since we don't know what the old transition mode was.
    16.         StartColorTween(Color.white, true);
    17.         TriggerAnimation(m_AnimationTriggers.normalTrigger);
    18.  
    19.         // And now go to the right state.
    20.         InternalEvaluateAndTransitionToSelectionState(true);
    21.     }
    22. }
    23.  
    A neater workaround than creating the bools in the animator is to switch the transition mode to animation, delete the default event names and then switch it back to whatever mode you want to use. The code will then bail out in the first if statement and never actually try to set the triggers on the animator at all.

    A bit annoying, I may spend a bit of time tomorrow evening trying to figure out a safe way to fix this, just guarding the call doesn't quite seem right as it was added to catch the case where you changed the transition mode and if you did have an animator controlling your transitions and switched back to a different mode you probably would want it to reset the animator. Perhaps just defaulting those transitions to empty and patching them up when you autogenerate the animator would be a better fix, that way you would still get legitimate warnings if you had text in those fields.
     
    hessel_mm likes this.
  45. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,019
    I'm getting this too... the Chris Trueman's workaround did the trick tho...
     
  46. banban

    banban

    Joined:
    Jul 2, 2015
    Posts:
    1
    Hi princetrunks, thanks for the fix!!
    I got the exact sale problem with Unity 5.

    I had a slider on which I add an animator component (via selecting the slider > open the animation window > click the create button). My slider was also non interactable, and I had changed the Transition to none.

    After changing the transition back to Animation, I could erase the 4 fields, then change again the transition to None. Then warnings were gone when playing!
    Well, I guess, the bug could be fixed if those field were cleared automatically by the editor if you choose "None" as transition.

    Yours.
     
  47. UniWatcher

    UniWatcher

    Joined:
    Aug 11, 2015
    Posts:
    2
    Unity 5.1.3f1 Personal. Getting same warnings in console.
    [​IMG]

    I set Transition to Sprite Swap on my GUI Button and not to Animation.
    [​IMG]

    I want an animation for my GUI Button like slide in/slide out, so I add Animator component.
    In general, this is an obvious a Unity bug.

    Also when I try "fix" with adding fake params
    Normal
    Pressed
    Highlighted
    Disabled

    Then I getting this warnings:
    [​IMG]
     
    Last edited: Sep 2, 2015
  48. JMSPT

    JMSPT

    Joined:
    Aug 11, 2015
    Posts:
    3
    This Worked for me.
    After Deleting the:

    1. Parameter 'Normal' does not exist.
    2. Parameter 'Pressed' does not exist.
    3. Parameter 'Highlighted' does not exist.
    4. Parameter 'Disabled' does not exist.
    I changed Transition back to Color Tint and the warnings were gone.
     
  49. YellzBellz

    YellzBellz

    Joined:
    May 17, 2015
    Posts:
    14
    I did the same thing and added 3 buttons with sprite swap transitions, was getting the same errors. Added the same bool parameters, saved the scene, switched to another scene, switched back, launched scene and the errors are gone.

    I did get the Animator Has Not Been Initialized when I first launched the scene before saving it, but once I saved the scene it seemed to have worked!

    Using Unity 5.2.0f3 Personal.
     
  50. NicoL3AS

    NicoL3AS

    Joined:
    Oct 7, 2015
    Posts:
    11
    Hello guys !
    I had the same issue. This topic is the first result in Google, so I resurrect it to provide a simple workaround:
    1. Select "Animation" as a transition
    2. Leave each field empty (see screenshot).
    In my case, the warnings disappear.
    Hope it helps!

    animator.png