// Update is called once per frame void Update() { //reduce time left time_left -= Time.deltaTime; if (owner == null) { Destroy(gameObject); } BuffEffect(); if (time_left <= 0) { if (on_enemy) { if (enemy_handle != null) { enemy_handle.DeregisterBuff(this); } } else { if (unit_handle != null) { unit_handle.DeregisterBuff(this); } } Destroy(gameObject); } }