OnTriggerExit with 2D Colliders?

I want to to make a 2D space game (average) and when I shoot, my sprite keeps going continuously up.
I have set a cube surrounding the outside of the game while the “Is Trigger” is selected with this script:

using UnityEngine;
using System.Collections;

public class DestroyCollider : MonoBehaviour
void OnTriggerExit(Collider other)

Shots are still escaping and is spamming my hierarchy!?
(Sorry im new tho Unity answers)


instead of using

void OnTriggerExit(Collider other)

use the 2D version, because you are using a sprite.

void OnTriggerExit2D(Collider2D other)

You could also change the 3D cube for the level boundary to a empty gameobject and give this object a BoxCollider2D, because you are using 2D sprites.

A good idea is also to take a look into the following project(if you dont know it already) because it is a example of a 2D space shooter with 3D Objects.