- Home /
 
               Question by 
               importguru88 · Jul 18, 2016 at 03:07 AM · 
                animator controllerstatestate-machineany  
              
 
              How do I transition from Any State to Die State On My animator controller properly
I am having a problem getting the die animation to play . So I far add Animation string to hash so I can play the die layer on my health script . I also have the gameobject on deactivate and I have some code in the if statement . I have four or same errors and two different errors . These are my errors error CS0116: A namespace can only contain types and namespace declarations. error CS1525: Unexpected symbol `anim' error CS8025: Parsing error I also have pics : I have the lines of code of where the is are at :
 I have the lines of code of where the is are at :
 static int anystate;
           void Start () 
      {
            anystate = Animator.StringToHash("Base Layer.Die");
 
      }
   private void DieLocal(Vector3 position, Vector3 force)
         {
             // Notify those interested.
             EventHandler.ExecuteEvent(m_GameObject, "OnDeath");
             EventHandler.ExecuteEvent<Vector3, Vector3>(m_GameObject, "OnDeathDetails", force, position);
 
             // Spawn any objects on death, such as an explosion if the object is an explosive barrell.
             for (int i = 0; i < m_SpawnedObjectsOnDeath.Length; ++i) {
                 ObjectPool.Instantiate(m_SpawnedObjectsOnDeath[i], transform.position, transform.rotation);
             }
 
             // Destroy any objects on death. The objects will be placed back in the object pool if they were created within it otherwise the object will be destroyed.
             for (int i = 0; i < m_DestroyedObjectsOnDeath.Length; ++i) {
                 if (ObjectPool.SpawnedWithPool(m_DestroyedObjectsOnDeath[i])) {
                     ObjectPool.Destroy(m_DestroyedObjectsOnDeath[i]);
 
                 } else {
                     Object.Destroy(m_DestroyedObjectsOnDeath[i]);
                 }
             }
 
             // Deactivate the object if requested.
             if (m_DeactivateOnDeath && anim.IsInTransition(0)  anim.GetNextAnimatorStateInfo(0).nameHash == anystate) {
                 Scheduler.Schedule(m_DeactivateOnDeathDelay, Deactivate);
                     GetComponent<AudioSource>().Play();
                     anim.SetBool("Dead", false);
             }
         }
 
 
                 
                aaeae.png 
                (239.8 kB) 
               
 
              
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                