- Home /
Question by
Razputin · Oct 24, 2017 at 06:22 AM ·
particlesparticle systemparticleplay
ScriptableObject.ParticleSystem.Play() Doesn't Work.
On each one of my weapons, which are scriptable objects, I have a particle system which I want to enable/disable for effects. However calling .Play() does nothing and doesn't give any errors.
public PlayerWeapons weapon;
if (Input.GetButton("Fire1") && fireCooldown == false)
{
chargingAttack += Time.deltaTime;
if (!weapon.particleSystem.isPlaying)
{
weapon.particleSystem.Play();
}
}
I also tried making a local variable and storing it in there but that didn't seem to work either. I could always instantiate it and then delete after a few seconds but is that really necessary?
Thanks for any advice!
Comment
Best Answer
Answer by ifurkend · Oct 24, 2017 at 07:04 AM
I guess your particle system is a prefab in the project folder that isn't present in the scene hierarchy. In such case, you either instantiate the prefab first or parent the particle effect object to your weapon if you don't like instantiation.