Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

oncollisionenter compare tag

private void OnCollisionEnter2D(Collision2D col)
    {
    	//for "OnCollision" you need "gameObject" listed not just "CompareTag"
        if (col.gameObject.CompareTag("weapon"))
        {
            Destroy(gameObject);
        }
    }
 
PREVIOUS NEXT
Tagged: #oncollisionenter #compare #tag
ADD COMMENT
Topic
Name
7+8 =