This question was 
             closed May 01, 2017 at 02:14 PM by 
             bonghnim. 
            
 
            Delay in time
So hi im working on making a special box where u step on it u get a special power,the ideal is when you leave it u still maintain the special power for an amount of time(3 sec) here are my code
using UnityEngine; using System.Collections;
public class SpecialPower : MonoBehaviour {
 GameObject Player;
 public bool effect = false;
 
 public bool cooldown = false;
 void Awake()
 {
     Player = GameObject.FindGameObjectWithTag("Player");
 }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject == Player)
     {
         
         effect = true;
        
     }
 }
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject == Player)
     {
         effect = true;
     }
 }
  
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.gameObject == Player  )
     {
         Invoke("DoSomeThing", 3);
     }
 }
 void DoSomeThing()
 {
         effect = false;
 }
 
               } so thank you for reading my post and if u guy can help i will be glad
               Comment
              
 
               
              Follow this Question
Related Questions
Time delay enemy respawn 3 Answers
Invoke is not like real time 2 Answers
Oncollisionenter and time,OnCollisonEnter and time. 0 Answers
Hide (not delete) text after given time..? 1 Answer
Mining in RTS 0 Answers