- Home /
Trying to Play my Particle System OnCollisionEnter Script
I think i'm doing something wrong. When I play my game and my player hits the object that has the Particle System Component and rigidbody, the particle system does not play,
var Dust : ParticleSystem;
function OnCollisionEnter(collision : Collision)
{
{
Dust = gameObject.GetComponent(ParticleSystem);
}
if(gameObject.tag == "Player")
{
Dust.Play();
}
}
Try
Dust.enableEmission = true;
just before the .Play()
I haven't used Shuriken much but I have one test script setup and that's doing it for me. If that doesn't do it, add a simple debug statement first in the OnCollisionEnter to verify your collision meets the requirements of one.
Answer by boshko · Mar 16, 2015 at 10:21 PM
Maybe someone will need this my script. Its a little bit extended and changed...
#pragma strict
var Particle : ParticleSystem;
Particle.enableEmission = false;
function OnTriggerEnter(){
Particle.enableEmission = true;
Particle.Play();
}
function OnTriggerExit(){
Particle.enableEmission = false;
Particle.Stop();
}
Your answer
Follow this Question
Related Questions
Playing a range of sounds from an object 0 Answers
Saving changes while playing... 1 Answer
On 2DCollision, particle system prefab does not play 0 Answers
Network view not attached 0 Answers