- Home /
Emit Particle on Collision Issue
I have a character that is going to collide with a coin. When the character collides with the coin, a particle "animation" should occur. Here's my code so far. Some basic assistance would help a lot. This code is attached to the player character.
void OnTriggerEnter(Collider _hit) { if (_hit.tag == "Coin") { Destroy(_hit.gameObject); coinCount++; coinsText.text = "Coins: " + coinCount.ToString() + "/" + coinTotal.ToString(); var Bling : GameObject = Instantiate(Bling, transform.position, Quaternion.identity); }
Your script looks good Idk what is the problem but Particle System can be activated in your case like this:
GameObject Bling = (GameObject)Instantiate(Bling, transform.position, Quaternion.identity);
// Activate PS
Bling.GetComponent<ParticleSystem>().Play();
// Deactivate PS
Bling.GetComponent<ParticleSystem>().Stop();
Your answer
Follow this Question
Related Questions
How can I emit animated prefabs from a particle system? 0 Answers
Partical System is not visible 1 Answer
How can I play an explosion animation? 3 Answers
Playing a different sprite prefab on collission. 1 Answer
OnCollisionEnter Animation 1 Answer