Instantiate collision particle

Hi,

I have two objects colliding to one another (in 2d space) and I would like to add a particle effect to it.
Here is the code that I’m running:


public class ColisionGreen : MonoBehaviour{

	public GameObject GreenParticle;

	void OnCollisionEnter (Collision col)
	{
		if(col.gameObject.name == "Green")
		{
			Instantiate (GreenParticle, transform.position,Quaternion.identity);
			Destroy(gameObject);

		}
	}
}

Code compiles but doesn't do what I want. There is no particle effect after collision.

Thanks

Try adding as GameObject to the end of the if statement.

if(col.gameObject.name == “Green”)
{
Instantiate (GreenParticle, transform.position,Quaternion.identity) as Gameobject;