Skip to content
Permalink
c222c96d18
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
21 lines (17 sloc) 481 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DontDestroyOnContact : MonoBehaviour
{
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Bullet"))
{
return; //makes sure the bullet doesn't destroy other bullets
}
if (other.CompareTag("Tilemap"))
{
Destroy(gameObject); //destroys the bullet if it hits any part of the tilemap
}
}
}