Quantcast
Channel: Answers by "schwertfisch"
Viewing all articles
Browse latest Browse all 18

Answer by schwertfisch

$
0
0

I am very new to Javascript but on similar occasions I use something like:

function OnTriggerEnter (col: Collider) 
{
    if (col.gameObject.tag == "wall"){
    Instantiate(soundEffect, transform.position, transform.rotation); //this will make a sound effect on collision
    Destroy(gameObject); //this will destroy the object the script is attached to
}

Viewing all articles
Browse latest Browse all 18


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>