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

How to get an Animator

Discussion in 'Scripting' started by Hapciupalit, May 28, 2015.

  1. Hapciupalit

    Hapciupalit

    Joined:
    Apr 24, 2015
    Posts:
    103
    How can I do Animator.Find("name") like for GameObject.Find("name")
     
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,741
    Code (CSharp):
    1. GameObject.Find("myObject").GetComponent<Animator>();
    You can't name a animator so just find the object than get its animator component
     
    Last edited: May 28, 2015
    Hapciupalit likes this.