0
\$\begingroup\$

I made a simple spaceship that has a particlesystem. When I press "space" button, spaceship should fly and particle system should instantiate and play. But it's not playing. It seems in hierarchy as clone but not playing.

As you see, particle effect is instantiating but not playing. It should play at bottom of spaceship

Those are codes

void FlyShip()
{


    if (Input.GetKey(KeyCode.Space))
    {

        rb.AddForce(Vector3.up * jumpForce);


        if (!takeoffSound.isPlaying)
        {

            // _rocketJetParticle is gameobject. 
            _rocketJetParticle = Instantiate(rocketJetParticle, new Vector3(transform.position.x, transform.position.y - 4, transform.position.z), transform.rotation);
            takeoffSound.Play();

        }

    }

    else 
    {
        //Destroy(_rocketJetParticle);
        takeoffSound.Stop();
        
    }


}
New contributor
Alpay Palabıyık is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$
3
  • \$\begingroup\$ Did you mean to tick the "Play on Awake" checkbox, if not manually starting the particle system via script? \$\endgroup\$ – DMGregory Feb 21 at 21:26
  • \$\begingroup\$ I wanted to play particle system when I instantiate gameobject. But It wasn't playing. I found the solution. If you don't tick "Play on Awake" , the particle system attached to gameobject doesn't work. I didn't know that. @DMGregory \$\endgroup\$ – Alpay Palabıyık 2 days ago
  • \$\begingroup\$ Want to share your solution as an Answer below? \$\endgroup\$ – DMGregory 2 days ago
0
\$\begingroup\$

I found the solution.

If you instantiate a particle effect and want it to play when it instantiate you should tick "Play on Awake" box

New contributor
Alpay Palabıyık is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
\$\endgroup\$

Your Answer

Alpay Palabıyık is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.