Last active
December 31, 2021 15:05
-
-
Save curious-username/0b7cacb493962e827a9821c6c51cae06 to your computer and use it in GitHub Desktop.
ontriggerenter2d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SerializeField] | |
private GameObject _explosionPrefab; | |
private void OnTriggerEnter2D(Collider2D other) | |
{ | |
if(other.tag == "Enemy_Laser") | |
{ | |
Instantiate(_explosionPrefab, transform.position, Quaternion.identity); | |
Destroy(this.gameObject); | |
Destroy(other.gameObject); | |
Destroy(GetComponent<Collider2D>()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment