Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Animator, Parameter does not exists bugg?

Discussion in 'Editor & General Support' started by Eqric, Jan 28, 2013.

  1. bhavi1

    bhavi1

    Joined:
    Oct 19, 2013
    Posts:
    5
    same bug in 5.3
     
    MrEsquire likes this.
  2. Deadelven

    Deadelven

    Joined:
    Jan 26, 2016
    Posts:
    1
    Hey guys Hope this thread isn't Zombied. I found a solution that works for me.
    Instantiate your prefab with the animator and network animator Disabled. and then add a script that Enables those scripts in the start.

    using UnityEngine;
    using System.Collections;
    using UnityEngine.Networking;

    public class StartAnimator : NetworkBehaviour {

    [SerializeField] Animator Zomanimator;
    [SerializeField] NetworkAnimator ZomNetworkAnimator;

    // Use this for initialization
    void Start () {
    Zomanimator.enabled = true;
    ZomNetworkAnimator.enabled = true;
    }

    // Update is called once per frame
    void Update () {

    }
    }
     
  3. Psychonerd

    Psychonerd

    Joined:
    Jan 25, 2013
    Posts:
    3
    Nothing worked for me. I ended up using boolean
     
  4. jakejolli

    jakejolli

    Joined:
    Mar 22, 2014
    Posts:
    54
    I've got this bug as well. Running Unity 4.7 something (newest 4.x release as of posting).

    It's definitely a bug. Some calls to SetInteger("integerName", int) cause the warning, others don't. Even with the warning, the integer is being set correctly... very strange.

    Not a real issue for me, just a bit disconcerting to see warnings for seemingly no reason...

    How can I submit a bug report? I'll also provide my project.
     
  5. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Well pointless to submit bug report on version 4.7 as they do not support it anymore.
    If we still see this issue on the latest version 5.3.2 then definitly should post a bug report with the bug report tool in the help menu of Unity.
     
  6. aldensnow

    aldensnow

    Joined:
    Feb 8, 2016
    Posts:
    1
    I didn't see the Animator Parameter window at first, once I put my parameter name in there things worked better for me.
     
  7. rad1c

    rad1c

    Joined:
    Feb 26, 2016
    Posts:
    21
    same issue here (April, 2016... original post is from 2012), save, close animator tab, restart sorts out until it pops up again (so has to do the same again, and again, and again...)
     
  8. jeremyplayraven

    jeremyplayraven

    Joined:
    Aug 21, 2015
    Posts:
    6
    This just started happening to me in 5.3.4f1 after an artist added a new Animator component to an object in the scene. If I can isolate it I'll open a new bug, but currently it would be a 5GB upload which I don't have time for.

    1) Recompile any script.
    2) This message appears twice (selecting the message in the console highlights the GameObject with the new Animator component):
    Code (CSharp):
    1. Parameter '' does not exist.
    2. UnityEditor.DockArea:OnGUI()
    3) Scripts finish compiling (regular code warnings appear in the console)
    4) This message appears twice, again for the same GameObject as before:
    Code (CSharp):
    1. Parameter '' does not exist.
    2. UnityEngine.UI.Selectable:OnValidate()
    5) Then this message appears twice (same GameObject):
    Code (CSharp):
    1. Parameter '' does not exist.
    2. UnityEngine.CanvasRenderer:RequestRefresh()
    6) And finally, this message twice:
    Code (CSharp):
    1. Parameter '' does not exist.
    2. UnityEditor.HostView:OnGUI()
     
  9. jeremyplayraven

    jeremyplayraven

    Joined:
    Aug 21, 2015
    Posts:
    6
    It also appears that if I have the Animator / Animator Parameter windows open, instead of the above side effects I get this message 5 times instead (in edit mode):
    Code (CSharp):
    1. Animator has not been initialized.
    2. UnityEngine.CanvasRenderer:RequestRefresh()
    And then if I play the scene, I get this message 5 times:
    Code (CSharp):
    1. Parameter '' does not exist.
    2. UnityEngine.UI.Selectable:OnValidate()
     
  10. better_walk_away

    better_walk_away

    Joined:
    Jul 12, 2016
    Posts:
    291
    For those having the same issue, do the following things:
    1. Check if the parameter name in C# script matches the one in the Animator Controller.
    2. Check if the Animator Controller is added to the character.
    3. Check if the C# script is added to the character.
    4. Close Animator Tab, and restart Unity.
    5. Remove those parameters in the Animator Controller, and add other type of parameter in it (if you were using float, then use integer instead). Now in the C# script, change the SetFloat function to SetInteger to match the Animator Controller we just changed. Run the project to see if warnings show up again the in the console. In my case, the "parameter doesn't exist" warning didn't show up anymore. So I change the parameters back to float type, and change the C# script back to original one. Finally, my problem resolved.
    I'm not sure what the problem is, but you can check these steps to see if your problem gets solved, too.
     
  11. Bezzy

    Bezzy

    Joined:
    Apr 1, 2009
    Posts:
    75
    [Edit: False Alarm! Figured it out. To control our layers' weight from animation curves, we add a parameter with the same name as the layer, check if that parameter is being controlled, and if it is, we set the weight of the layer to that curve value. And yes, it means that we're kind of a frame behind with the layer weights, but we can always call "animator.Update(0)" to refresh. Probably not good for stuff that's animated en masse, but this is a one off in our game.

    Anyway, yeah, i forgot to add a parameter with the same name]


    Just appeared in 5.5.0f3 for me after an upgrade.
    Code was previously working.
    I cached off hashes of each layer into a list, during Awake(), using _anim.layerCount to iterate through all the animator's layers, and _anim.GetLayerName(i) to get the name of the layer.

    When the hashed values are used used in Update(), only the last layer seemed to throw up the warning.

    I tried putting the caching in Start() instead of Awake() because I've sometimes had trouble with affecting the animator as early as Awake(). But it didn't make any difference.

    The particular call that caused the error is Animator's "IsParameterControlledByCurve( hashValue )"
     
    Last edited: Dec 7, 2016
  12. xxchkzgames

    xxchkzgames

    Joined:
    Dec 18, 2016
    Posts:
    1
    if you are coding like: public Animator anim; and then anim = findobjecoftype<Animator>();
    replace anim.set bool/trigger etc to getcomponent<animator>().bool/trigger ect
    :)
     
  13. tmendez

    tmendez

    Joined:
    Oct 12, 2015
    Posts:
    39
    Had the same problem, just had to add the variable name (in my case, "Normal") to the Animator's parameters as a trigger.

     
  14. Isazero

    Isazero

    Joined:
    Jun 16, 2017
    Posts:
    1
    Same problem. Version 5.6.1f . Literally, tried everything from above. I don't what to do. This is error "
    Parameter 'State' does not exist.
    UnityEngine.Animator:SetInteger(String, Int32)
    Character:set_State(CharState) (at Assets/Scripts/Character.cs:18)
    Character:CheckGrounded() (at Assets/Scripts/Character.cs:84)
    Character:FixedUpdate() (at Assets/Scripts/Character.cs:36)"

    And here is my code "
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Character : MonoBehaviour {
    [SerializeField]
    private int lives = 5;
    [SerializeField]
    private float speed = 3.0F;
    [SerializeField]
    private float jumpForce = 15.0F;

    private bool isGrounded = false;

    private CharState State
    {
    get {return (CharState)GetComponent<Animator>().GetInteger("State"); }
    set { GetComponent<Animator>().SetInteger("State", (int) value); }
    }

    new private Rigidbody2D rigidbody;
    private Animator animator;
    private SpriteRenderer sprite;


    private void Awake()
    {
    rigidbody = GetComponent<Rigidbody2D>();
    animator = GetComponent<Animator>();
    sprite = GetComponentInChildren<SpriteRenderer>();

    }

    private void FixedUpdate()
    {
    CheckGrounded();
    }

    private void Update()
    {
    if (isGrounded)
    {
    State = CharState.Idle;
    }

    if (Input.GetButton("Horizontal"))
    {
    Run();
    }

    if (isGrounded && Input.GetButtonDown("Jump"))
    {
    Jump();
    }
    }

    private void Run()
    {
    Vector3 direction = transform.right * Input.GetAxis("Horizontal");

    transform.position = Vector3.MoveTowards(transform.position, transform.position + direction, speed * Time.deltaTime);

    sprite.flipX = direction.x < 0.0F;

    if (isGrounded)
    {
    State = CharState.Run;
    }
    }

    private void Jump()
    {
    rigidbody.AddForce(transform.up* jumpForce,ForceMode2D.Impulse);
    }

    private void CheckGrounded()
    {
    Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, 0.8F);

    isGrounded = colliders.Length > 1;

    if (!isGrounded)
    {
    State = CharState.Jump;
    }
    }
    }

    public enum CharState
    {
    Idle,
    Run,
    Jump
    }"

    If somebody can help me I would be so much grateful
     
  15. Eggtooth

    Eggtooth

    Joined:
    Dec 29, 2015
    Posts:
    3
    Same error. I think I will just stop using unity. I was considering upgrading to pro but this engine is so buggy and unfinished, that I think Unreal will be better, even though porting everything will take time.
     
  16. postilgadima

    postilgadima

    Joined:
    Sep 26, 2017
    Posts:
    1
    Is still actual in Unity 2017.1.1f1


    Animator has bool parameter "isHidden" .
    C# script call :

    bool isHidden = contentPanel.GetBool("isHidden");

    Result in console:
    Parameter 'isHidden' does not exist.

    I found a solution, because it was my fault. It is not my fist "isHidden" parameter in the game and I'm very lazy , so i always did copy-past of "isHidden" and after that I set it to the new animator.

    In the result I had "isHidden " in the animator. "isHidden " and "isHidden" . It is different parameters but in Unity it is unpossible find current mistake if you don't know about it

    Dear Unity's developers team, Could you split name of parameters by SPACE before and after full words? It will be awasome.
     
  17. Deleted User

    Deleted User

    Guest

    Happens on version 2017
     
  18. LeRan

    LeRan

    Joined:
    Nov 24, 2015
    Posts:
    118
    Confirmed, bug still there. The animator fails to identify miscellaneous parameters ("Parameter XXX does not exist") which vary over the course of the execution : some time parameter A is missing, other times in the same loop parameter A exists but parameter B does not, sometimes both exist or both don't... I failed to identify the logic behind that. For me it's always "integer" of "float" parameters that go missing, I never saw it happening to booleans.

    It seems that trouble started when I added a "trigger" parameter. Now I deleted it, closed the tabs, restarted Unity, build anew... nothing works, it seems to be definitely buggy.

    Nota: I don't want to file a bug report, because my project is rather huge now and I don't want to spend days or weeks epuring eveything until I sort out the bug in a standalone executable.

    P.S. or erratum : I'm not even sure of what I just wrote. Further testing makes everything even more blurred. In a few occasions it said that one parameter did not existe while setting and displaying its correct value. And now I can't even reproduce this behaviour. I'd better go for a walk.
     
    Last edited: Dec 3, 2017
    sahilsrivastava and MrEsquire like this.
  19. sahilsrivastava

    sahilsrivastava

    Joined:
    Jan 18, 2018
    Posts:
    9
    The bug is still here apparently...in 2018
     
  20. Ashkaari

    Ashkaari

    Joined:
    Feb 22, 2016
    Posts:
    1
    So sad that I encounter this bug too,using Unity 2017.04 Version, and it's 2018.05.09. Five years has past this bug still exists.
     
    Last edited: May 9, 2018
  21. pierrepaul

    pierrepaul

    Unity Technologies

    Joined:
    Jun 19, 2012
    Posts:
    162
    Hi.

    The message might popup when a script is reloading - ie during a domain reload. Its a know issue but it should not affect gameplay at all. Otherwise we often see a " " problem. Ie a space before/after the parameter name.

    If its something else, please file a bug with repro. I cannot find any bug in our database that matches what is described here. And I personnaly have never experienced this bug.
     
  22. Hirni

    Hirni

    Joined:
    Jul 12, 2018
    Posts:
    1
    I got the same problem (2018.1.7f1). This is not a space-issue. For me it's a boolean parameter which I cannot set.
    Neither switching the Animator tab off and restarting Unity nor rewriting the code to get the Animator directly works for me.
     
  23. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    Open the animator controller in a text editor (ensuring that your assets are serialized as text) and check the name of the parameter as serialized by Unity. That should reveal what is going on.
     
  24. maxinetoto

    maxinetoto

    Joined:
    Apr 4, 2018
    Posts:
    1
    I just got this error in 2018.1.6f1. Firstly, my code was working fine yesterday. I read through all the posts here and tried everything. I have the parameters window open and I can literally SEE the parameters. There are three. When I debug the animator object, I get that "Animator Parameter Count: 1" and "Parameter 0 is UnityEngine.AnimatorControllerParameter"

    Edit: It now works again after I renamed everything. Really don't think it's a typo since the problem is only intermittent.
     
    Last edited: Aug 3, 2018
  25. csiro_rmc3

    csiro_rmc3

    Joined:
    Jun 8, 2014
    Posts:
    14
    Just a note I thought I had this problem too - was a case typo in my case, On vs on. Not discounting other's experiences - just suggesting another thing to check.
     
  26. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    118
    I experienced the same bug. Closing the animator window and restarting made it go away.

    2018.3.0f2
     
  27. Thomas-Bousquet

    Thomas-Bousquet

    Joined:
    Dec 19, 2016
    Posts:
    41
    Similar problem in 2018.3.7f1 Personal. I have a custom editor that parses the animator parameters to put them in a Pop menu and
    Code (CSharp):
    1. //where anim is an Animator
    2. foreach (AnimatorControllerParameter param in anim.parameters)
    3. {
    4. //...
    5. }
    doesn't loop; the size of anim.parameters being 0.

    No script is compiling, there are no errors or warning in the log.
    The animator window shows the proper parameters; I can change their value..

    It 'seems' to be happening after making some code changes; but it isn't a consistent repro.
     
  28. rgeeinstead

    rgeeinstead

    Joined:
    Dec 5, 2018
    Posts:
    1
    Still experiencing the bug.2018.2.18 version. Tried shutting down the animator and inactivating the animator for each effected object and restarting but this did not fix it. All was running fine yesterday but the bug started inexplicably today. Also tried removing all triggers, booleans, in the animator and recreating. Still get the error. Tried removing conditions on transitions and recreating with the new parameters, and still get the error. Double checked syntax in code and all is good.
    Getting frustrated here.
     
  29. Straightuptech07

    Straightuptech07

    Joined:
    Jan 26, 2019
    Posts:
    5
    I am Having the same problem with the Bug. If I delete the states and parameters and again make the animation it starts for the current session but as soon as I close unity and start it again all the trigger animation freezes only the animations in Update function are working. Please help..
     
  30. tinho1990

    tinho1990

    Joined:
    Jul 17, 2019
    Posts:
    3
    Same bug
    2019.1.10f1
     
  31. Swarly1803

    Swarly1803

    Joined:
    Mar 30, 2020
    Posts:
    4
    Same bug in 2020.1.0b3
     
  32. ErkanAkin

    ErkanAkin

    Joined:
    Oct 26, 2019
    Posts:
    8
    Guys if gameobject which contain animator is not active in scene unity can't get parameters.
     
  33. Deleted User

    Deleted User

    Guest

    :)
     
  34. Epicnez

    Epicnez

    Joined:
    Feb 7, 2018
    Posts:
    6
    I am having this problem as well! uhhhhhhhhhhhhh2.png
     
  35. moloy559

    moloy559

    Joined:
    Jun 19, 2016
    Posts:
    1
    I had the same bug in 2019.3.2.1. I did the close animator tab and restart, but It still couldn't find a float. Then I deleted that float, added a new copy and now it works. If you mess with it long enough it will eventually work, but this is an insanely annoying bug.
     
  36. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    Considering how many years it had been since I've last seen this and how many animator controllers and of what complexity our company has made in those years, I'd say that this manifestation of the issue is not a bug, rather annoying UX behaviour. If you use version control, and you should be using version control, check what exactly the string serialised in the controller file was, versus what it is now. I bet it had some crap appended to it.
     
  37. omar_5

    omar_5

    Joined:
    Feb 8, 2020
    Posts:
    9
    I don't know the problem, but I was triggering my animation from a script from another when calling it from the attached script it worked
     
  38. pleasurehouse

    pleasurehouse

    Joined:
    Oct 15, 2020
    Posts:
    96
    Same problem (Unity 2020.1.13f). I don not what can i do!! :-(
     

    Attached Files:

  39. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    Open the controller file and have a look at how exactly it's spelt, there may be sole invalid characters in there.
     
  40. pleasurehouse

    pleasurehouse

    Joined:
    Oct 15, 2020
    Posts:
    96
    Thank you for your response, but that was not the problem...
    I found the problem rigth now.
    i was getting access to the animator like this.

    public class PlayerMove : MonoBehaviour
    {
    private Animator animator;
    }


    void Start()
    {
    animator = GetComponent<Animator>();
    }


    I changed it, and now i getting acces to the animator like this:

    public class PlayerMove : MonoBehaviour
    {
    public Animator animator;
    }


    That solved the problem (at the moment)... i hope forever... we will see...
     

    Attached Files:

  41. pleasurehouse

    pleasurehouse

    Joined:
    Oct 15, 2020
    Posts:
    96
    ------------------------
    UPDATE (A day Later)
    -----------------------
    I found another reason that could be cause the problem... i found in antoher folder other animator controler with the same name (duplicated animator controler)... i don't know how happened it but i think it was the real problem... i hope my experience help somebody... now i think the editor work pefect... Thanks to Unity team for your exelent work.
     
  42. benbastien

    benbastien

    Joined:
    Dec 23, 2020
    Posts:
    3
    I just came across this issue as well. Removing Animator tab, restarting, rebuilding all did not work. I had to add the parameter 'Blend' to get it to stop.
     
  43. MingyueMeow

    MingyueMeow

    Joined:
    Feb 22, 2018
    Posts:
    6
    Same from 2021, copied parameter name is not recognized.
     
  44. wmsferreira

    wmsferreira

    Joined:
    May 3, 2021
    Posts:
    1
    Hi , just adding one more possible solution for anyone with the same problem.

    I had the same problem yesterday with the animator "setbool parameter does not exist" issue when scripting an enemybehaviour script in 2021 and couldn't solve with any answer in the forums about the same problem (I read every single one of them and tried everything). I couldn't keep going with the game due to this error so I tried removing the "anim.setbool" command but it didn't work, not even removing the controller worked, so I thought it was an actual bug.

    Turns out I was checking the wrong script since I had more than one enemy and more than one enemy scripts. So the problem was with another script of another enemy, who didn't need parameters to work at all, since it was the script of a patroling enemy and it's only state is "flying". The main problem, I believe, is that the "parameter does not exist" error does not inform which file is generating the error or requiring the parameter in first place.

    Anyway, if anyone have the same problem, try looking for solutions like this one. Try finding the source of the error in the code of the script and also in the other scripts you have in your objects. Removing the anim.set("parameter") from the code, as well as anything that you think might be causing it, should resolve if it's the source of the problem. If not, the problem is probably in another script.
     
  45. dansopanso

    dansopanso

    Joined:
    Jun 14, 2018
    Posts:
    11
    Had the same Issue in 2020.3.4

    Closing and restarting the Animator window did not help. What eventually worked was to use another name for my parameter. I deleted the bool "Hit" and created a new one "isHit" and then it worked. For some reason "Hit" was just not found, even after deleting and creating a new one
     
  46. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    Everyone, since I cannot believe this thread is still going, my advice is still the same it was three years ago: Open the animator controller in a text editor and see exactly what the parameter looks like in the serialization. It's not magic.
     
    Mezcaholic likes this.
  47. Mezcaholic

    Mezcaholic

    Joined:
    Dec 13, 2012
    Posts:
    17
    So I just hit this 2020.3.18f1, my animations would play but I would get "Animator.GotoState: State could not be found UnityEngine.Animator:play (string,int)" But everything was working for me. I just can't stand having a bunch of noise in the console window.

    I did what Alkis suggested. Ultimately I had renamed two of my clips in the project but the controller still listed them with the old names. I have no idea why it was still working but I changed the names in the controller and restarted Unity and now I have a squeaky clean console window.

    @Alkis, gracias amigo.

    -E
     
    AlkisFortuneFish likes this.
  48. kriorea

    kriorea

    Joined:
    Oct 9, 2020
    Posts:
    1
    Had the same in Unity 2021.1

    It looks like if u have several animators with different trigger (bool, etc) names within, Unity starts to trying to get all this names in each animator and in case of failure sends the message "Parameter 'name' does not exist."
    It can be solved (message will not be send) by making all list of triggers in each animator, but it sounds stupid.
     
  49. AlkisFortuneFish

    AlkisFortuneFish

    Joined:
    Apr 26, 2013
    Posts:
    970
    It doesn't. Please post what you are doing so we can shed some light as to what is going on.
     
  50. ronaldmaymone22

    ronaldmaymone22

    Joined:
    Oct 25, 2020
    Posts:
    1
    Facing the same problem in 2020.3.19f1
    Screenshot (51).png
    Screenshot (52).png
    I checked the name of the Trigger as you can see and it's as it should be.