Skip to content

How to Instantiate Particles System on Collision

public GameObject particlesPrefab;

public Transform origin;

void OnTriggerEnter(Collider collider)
{

if (collider.gameObject.CompareTag(“Tag”))
{

GameObject particlesPrefabInstance = (GameObject)Instantiate(particlesPrefab, origin.TransformPoint(0, 0, 0), origin.rotation);

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *