2D Power up script not working
The script is supposted to teleport the power up to another GameObject, set bool to true, wait 5 seconds, teleport the power up back and set the bool to false. I do not understand why, but it only sets the bool to true and thats it.
     private void OnTriggerEnter2D(Collider2D collision)
     {
         if (collision.gameObject.CompareTag("jump_boost"))
         {
             bpos = GameObject.Find(collision.gameObject.name).transform.position;
             GameObject.Find(collision.gameObject.name).transform.position = GameObject.FindWithTag("RESET").transform.position;;
             StartCoroutine(canmegajump());
             GameObject.Find(collision.gameObject.name).transform.position = bpos;
         }
     }
     IEnumerator canmegajump()
     {
         _megajump = true;
         yield return new WaitForSeconds(5f);
         _megajump = false;
     }
 
              
               Comment
              
 
               
              This is a duplicate of: https://answers.unity.com/questions/1629063/2d-power-up-script-not-working.html
Your answer
 
             Follow this Question
Related Questions
2D Power up script not working 0 Answers
2D Game powerup script not working at all 0 Answers
I have a specific problem with my trigger 0 Answers
KeyCode not detected when OnTriggerStay = true 1 Answer
Script for teleport on collision? 2 Answers