Unity Play mode issue

Hey, Guys I am getting issues in Unity with my effects, when I play effects directly in Unity play mode some parts at the beginning disappeared and when I recode that effect in Unity Recoderd it’s coming perfectly, why it’s happing like this play mode and recorded both views coming differently anyone can help me with that plz? thanks.

Can you record your editor?

yup, I can, do you wanna see what issue I am facing?

Yup, I’m not exactly sure what’s happening so wanna see

here is the video if you watch this you will understand what I am trying to say, this is happening to me many times with every Effact , thanks Dropbox - 2023-05-14 16-47-28.mp4 - Simplify your life

It’ll sound a bit stupid because it is. Unity hangs a bit when entering playmode.
It’s just is like that. Delay your effect by a second or two somehow and it will look right.

1 Like

Try pressing the pause button before you press play, wait a couple of seconds for Unity to get into play mode, then unpause. fleity comment is correct, this is just a workaround if you don’t want to add some start delay to the effect.

I’d suggest turning off play on awake on the particle system, and writing a little script with a UI button, or a keyboard shortcut, that tells your effect to play.

1 Like

Thanks a lot, It worked if I am pressing Pause Button before playing, but I never wrote any script, can you help me with that how to write that script?

Sure thing.

using UnityEngine;

public class PlayParticleSystem : MonoBehaviour
{
    //We'll use this variable to control your particle system
    public ParticleSystem myPFX;
    
    // Update is called once per frame
    void Update()
    {
        //***************
        //this section is a safety check, it'll stop runtime errors if you haven't assigned a particle system
        if (myPFX == null)
        {
            //This line puts a message in the console letting you know what went wrong
            Debug.Log("You haven't assigned a particle system in the inspector");
            
            //This line stops the code from running any further
            return;
        }
        
        //***************
        //this sections listens for some input, in this case, the spacebar
        if (Input.GetKeyDown("space"))
        {
            //this tells the particle system to play
            myPFX.Play();
        }
    }
}

Create a new C# script in your project named PlayParticleSystem.cs, open the file and delete all of the contents, copy and paste the above code into it ( that box has s scroll bar, so make sure you get all of it ), and then save the file.

Switch back to Unity, add an empty game object to your scene, and drag and drop the PlayParticleSystem script onto it from the project panel.

Select the game object and look at the inspector, you should see a slot named My PFX. Drag and drop the particle system from the scene into that slot.

Now play your scene, whenever you press the spacebar the assigned particle system will play.

Hopefully that helps you out!

thanks a lot, I gonna do this right away

I am Using VFx Graph and I have prefabs it’s not working, I can not drag them

Ah, I haven’t used VFXGraph before… I can’t really help you out with that. sorry

okay, no worries but you did very well. I will save this Scipt for the future and use it when I will Use the particle system, thanks a lot.

1 Like