Performance ParticleSystem and GameObject

Hi everyone,

I dont need help on scripting this time but some “advice” that i can’t found on internet yet.

I’m looking for a game with very great performance (FPS have to go upper than 200), so i’m looking for optimisation.
I see two things : ParticleSystem take a lot of time on a frame, even if nothing is playing, and GameObject processing, even if they are not in view.

Fact :
In my game, i have like 40 little particleSystem on screen but played occasionaly (no loop).
I can have between 100 and maximum 5000 gameObject in the scene.

I test my game with simple cube and 4000 gameObject active, it works pretty fine.
I test my game with a “complex” gameObject, like the basic “palm” in Unity, it works… not so fine. I got a bad framerate.

So i have some question and i need some advice before i implent this on the game (because i need to change some things with this) :

First : Why particleSystem cost performance even if it’s not playing ?

I made a little script for this : I attach on each gameObject which contains my particleSystem a little script simple desactivate the particleSystem gameObject if it’s active and if the associated particleSystem is not playing.

        void FixedUpdate() {
		if(gameObject.active  !gameObject.transform.particleSystem.isPlaying){
			gameObject.active = false;
		}
	
	}

Is it a good idea ? If not : Why, and have you a better solution ?

For the gameObject problem, i made an other script. The script is a simple “container” of all the gameObject in the scene.
And doing this : if a gameObject “is close to be view”, so active it. Something like this :

       void FixedUpdate() {
                //listarrow is a Dictionary of <double, GameObject>, this is the association between a gameObject and the time he needs to appear in front of the camera. This contains ONLY disable gameObject, no one is active.

                //I check the first gameObject where its time is under the real time + a range (in this case he will be appear a bit before he's gonna go in front of camera)
		var next = listarrow.FirstOrDefault(c => c.Key < (time + zoneAppear)); 

                if(next != null){
                       //I put this gameObject and children to true
		       next.Value.SetActiveRecursivly(true);   
                        //remove the gameObject active on the list
		       listarrow.Remove(next.Key);        
		}
	}

Same question : Is it a good idea ? Why not, and what’s the best solution ? (PS : disable again after they pass the camera is not a problem, it’s already done.)

Thank you for your attention and your precious advices :slight_smile:

still need some helps :frowning: