Why does my OnCollisionEnter2D not work?

So, I’m trying to implement power ups in my game and they work well and all, but when I collide with my power ups they just move like I’m pushing them, even though I have OnCollisionEnter2D in the script, it doesn’t work, and the reason why I have it with collision and not trigger is because I don’t want them to be floating in the air, meaning that they have a rigid body and that they have gravity applied to them. Why does this not work?

var ScoreToGive : int;

var PowerUpName : String;

var PlayerScript;

function Start () {

var Player = GameObject.FindGameObjectWithTag("Player");

PlayerScript = Player.GetComponent(InfiniteScore);


function OnCollisonEnter2D (Other : Collider2D) {

if(Other.gameObject.tag == "Player"){

PlayerScript.CurrentScore += ScoreToGive;
Debug.Log("The player acquired a/n " + PowerUpName);
Destroy (this.gameObject);



I believe the parameter to OnCollisionEnter2D should be of type Collision2D not Collider2D.

From Unity Script Reference:

 void OnCollisionEnter2D(Collision2D coll) {
        if (coll.gameObject.tag == "Enemy")
            coll.gameObject.SendMessage("ApplyDamage", 10);

There’s a few things you have to do:

  1. The PowerUps needs to be on a different layer than the player and then go to Edit->Project Settings → Physics2D to make sure they don’t push each other around.
  2. Next just add another collider to your PowerUp and set it to IsTrigger
  3. Last, add a OnTriggerEnter2D(Other : Collider2D) to your script (instead of OnCollisionEnter2D)

That should do it

make sure you dont have collider scripts on both objects, unity seems to chose the simpler one, the one that hasnt had any varibles modified…