// Update is called once per frame void Update() { if (_isDead) { rb.freezeRotation = false; gameObject.transform.position += new Vector3(0, Random.Range(0.1f, 0.5f), 0); gameObject.transform.eulerAngles += new Vector3(Random.Range(-360, 360), Random.Range(-360, 360), Random.Range(-360, 360)); DespawnTimer -= Time.deltaTime; if (DespawnTimer <= 0f) { Destroy(gameObject); AISpwn.SetEnemyTotal(); AISpwn.RemoveEnemyFromList(this.gameObject); } } }