- Home /
Question by
ZtekMiniGame · Dec 21, 2017 at 05:07 AM ·
instantiateplayerprefsparticlesystem
Playing an Instintiated particle system prefab.
I need to know how to make it so that when a playerpref is == to 1 the particle system will play. pls help.
Comment
$$anonymous$$ake sure the particle effect has disabled "play on awake" and use ParticleSystem.Play() in your true if statement.
When I do that ParticleSystem.Play() is underlined red
Answer by ifurkend · Dec 21, 2017 at 06:45 AM
You probably has played the source particle prefab in the project folder. You should create another ParticleSystem variable to contain that instantiated clone in the scene and play the clone instead.
That's exactly what I'm doing and its still not playing. Now it just pauses the script when I get to that spot in the code.
This is all of my code
void Start () {
PlayerPrefs.SetInt("BombHit", 0);
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider other)
{
if (other.name == "Sphere")
{
PlayerPrefs.SetInt("BombHit", 1);
Explode.Play();
Destroy(gameObject);
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612144947im_/https://answers.unity.com/themes/thub/images/avi.jpg)