- Home /
when a stopped particle system gets stopped it plays.,When a stopped particle system gets stopped again It plays??
in the code below When I smash an obstacle while still being in the air the particle system gets turned on instead of staying stopped
void Update() { if (Input.GetKeyDown(KeyCode.Space) && isOnGround && !gameOver) { playerRb.AddForce(Vector3.up *jumpForce , ForceMode.Impulse); isOnGround = false;
playerAnim.SetTrigger("Jump_trig");
dirt.Stop();
playSound.PlayOneShot(jump);
}
}
private void OnCollisionEnter (Collision collision)
{
if (collision.gameObject.CompareTag("Ground"))
{
isOnGround = true;
dirt.Play();
}
else if ( collision.gameObject.CompareTag("Obstacle"))
{
Debug.Log("Game Over");
gameOver = true;
playerAnim.SetInteger("DeathType_int", 1);
playerAnim.SetBool("Death_b", true);
explosion.Play();
dirt.Stop();
playSound.PlayOneShot(crash);,When the player smashes into an obstacle while he is still in the air the particle system gets turned on instead of staying stopped..
void Update() { if (Input.GetKeyDown(KeyCode.Space) && isOnGround && !gameOver) { playerRb.AddForce(Vector3.up *jumpForce , ForceMode.Impulse); isOnGround = false;
playerAnim.SetTrigger("Jump_trig");
dirt.Stop();
playSound.PlayOneShot(jump);
}
}
private void OnCollisionEnter (Collision collision)
{
if (collision.gameObject.CompareTag("Ground"))
{
isOnGround = true;
dirt.Play();
}
else if ( collision.gameObject.CompareTag("Obstacle"))
{
Debug.Log("Game Over");
gameOver = true;
playerAnim.SetInteger("DeathType_int", 1);
playerAnim.SetBool("Death_b", true);
explosion.Play();
dirt.Stop();
playSound.PlayOneShot(crash);
Your answer
Follow this Question
Related Questions
Flip Particle System Graph 0 Answers
ParticleSystem TriggerModule: Collide with world / collide with unlimited colliders? 0 Answers
Particle System Working in game view but not working on Android build. 1 Answer
How can I change the gravity modifier of a particle system through script? 1 Answer
How to create a particle system like Absorb power in unity 1 Answer