Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by importguru88 · Jul 22, 2016 at 03:42 AM · animatortriggercontrollerparameters

How do I play trigger parameters properly in the animator controller /

I have two different enemy ai I only gotten one trigger parameter to play on one of my enemy ai . I name the trigger parameter the same as the other enemy ai . I change one of the enemy ai and the die animation still didn't work when I kill the enemy ai . The die animation is not set on loop . I also tried closing the animator tab and restarting . I deleted the parameter and re-adding the parameter press and die animation still don't work. Here is my script :

     // Exposed properties
         public bool Invincible { set { m_Invincible = value; } }
         public float MaxHealth { set { m_MaxHealth = value; } }
         public float MaxShield { set { m_MaxShield = value; } }
         public float CurrentHealth { get { return m_CurrentHealth; } }
         public float CurrentShield { get { return m_CurrentShield; } }
         public float ShieldRegenerativeAmount { set { m_ShieldRegenerativeAmount = value; } }
         public AudioClip deathClip;
         public bool isSinking;
         static Animator anim;
      
      void Start () 
      {
              anim = GetComponent<Animator> ();
      }
      
  
   
         // Internal variables
 #if ENABLE_MULTIPLAYER
         [SyncVar(hook = "SetHealthAmount")] 
 #endif
         private float m_CurrentHealth;
 #if ENABLE_MULTIPLAYER
         [SyncVar(hook = "SetShieldAmount")]
 #endif
         private float m_CurrentShield;
         private ScheduledEvent m_ShieldRegenerativeEvent;
         private float m_SpawnTime;
 
         // SharedFields
         protected float SharedProperty_MaxHealth { get { return m_MaxHealth; } }
         protected float SharedProperty_MaxShield { get { return m_MaxShield; } }
         protected float SharedProperty_CurrentHealth { get { return m_CurrentHealth; } }
         protected float SharedProperty_CurrentShield { get { return m_CurrentShield; } }
 
         // Component references
         protected GameObject m_GameObject;
         protected Transform m_Transform;
         private Rigidbody m_Rigidbody;
 
         /// <summary>
         /// Cache the component references and initialize the default values.
         /// </summary>
         protected virtual void Awake()
         {
             
            anim = GetComponent <Animator>();
             m_GameObject = gameObject;
             m_Transform = transform;
             m_Rigidbody = GetComponent<Rigidbody>();
 
             SharedManager.Register(this);
 
             m_CurrentHealth = m_MaxHealth;
             m_CurrentShield = m_MaxShield;
 
             // Register for OnRespawn so the health and sheild can be reset.
             EventHandler.RegisterEvent(m_GameObject, "OnRespawn", OnRespawn);
         }
 
 
 
 
 
 
 
  if (m_DeactivateOnDeath) {
                 Scheduler.Schedule(m_DeactivateOnDeathDelay, Deactivate);
                     GetComponent<AudioSource>().Play();
                     anim.SetTrigger("Dead");
                 anim.SetTrigger("death");
 
                     
             }
         }

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image importguru88 · Jul 22, 2016 at 03:44 AM 0
Share

Here is a pic :

alt text

123a.png (255.3 kB)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rmassanet · Jul 22, 2016 at 07:22 AM

If you look at the bottom of the screenshot, you will see the message console is telling you that there is no death parameter declared in the Animator.

However, in your screenshot, I see a death trigger parameter declared. Could it be that you are editing an animation controller, different than the one that is attached to the script's game object?

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image importguru88 · Jul 22, 2016 at 09:47 AM 0
Share

The die animation time is different from the other gameobject.

avatar image rmassanet importguru88 · Jul 22, 2016 at 10:16 AM 0
Share

An Animator is not the same thing as an Animation. The script you posted, is attached to a GameObject. That GameObject should have an Animator attached, because you are requesting it. Does that Animator have a death trigger parameter?

avatar image importguru88 rmassanet · Jul 22, 2016 at 10:41 AM 0
Share

Yes. It do.

Show more comments
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

63 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Parameter walk does not exist 0 Answers

How do I pass a parameter for trigger animations in the animator controller unity 5 file 0 Answers

Animator Trigger Not Working 1 Answer

Animator in Unity 5 0 Answers

Javascript to control parameters of animator controller 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges