Can you help me about collision please ?

Hi every body ! so i have a problem with my game ^^

So i want my player restart the game when he enter in collision I write this and that is good, it is working

using UnityEngine;
using System.Collections;
public class Perso : MonoBehaviour {
	Animator anim;
	// Use this for initialization
	void Start () {
		anim = transform.GetComponentInChildren<Animator> ();

}

// Update is called once per frame
void Update () {
	}
void OnCollisionEnter2D (Collision2D Finish)
{
	PersoMort ();
	anim.SetTrigger ("mort");
}
void PersoMort () {
	Application.LoadLevel (Application.loadedLevel);
}

}**

BUT, i have a floor, the floor have box collider and at first of game the caracter lose and the game restart and i want not that i want he restart the game only when he touch obstacle

Please help me, and thank you for working

What I understand from you is you want to restart the game only when the player hit the obstacle and not when he hit the floor ,
If I am right you can simply check the name or the tag of the gamobject he collided with
like

void OnCollisionEnter2D (Collision2D Finish)
 {
if(Finish.gameobject.name == "obstacle"  )
{
     PersoMort ();
     anim.SetTrigger ("mort");
}

 }
 void PersoMort () {
     Application.LoadLevel (Application.loadedLevel);
 }

Thats because anything the player collides with currently is invoking the scripts OnCollisionEnter2D method.

You could name or tag your in scene objects and check to ensure that it’s not the floor, or only obstacles.

// Snip

void OnCollisionEnter2D (Collision2D Finish)
{
  if (Finish.gameObject.tag == "Obstacle")
  {
    PersoMort ();
    anim.SetTrigger ("mort");
  }
}

// Snip

In the above case, assuming the obstacles are tagged “Obstacle” the if statement evaluates whether the game object is tagged obstacle and run your loadlevel and animation, if it’s anything else, it will not execute that code block.

i assume this code is on your player. So when colliding, you should check what have you collided with, and if it’s obstacle you can reload.

void OnCollisionEnter2D (Collision2D finish)
 {
     if(finish.gameObject.Tag == "Obstacle")
     {
         PersoMort ();
         anim.SetTrigger ("mort");
     }
 }

You can set the Tag in inspector.