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
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
Player Can Not get off platform 1 Answer
How can I collect collider2Ds(Trigger) the player is in into an array 1 Answer
Weird text field bug? 1 Answer