- Home /
Problem with the performance when activating gameObject
I am making a mobile game. In order to gain performance I am using gameObject Pooling. I have enemies with four phases (each one with its own mesh, which have been created using pro builder and then molded with PolyBrush). I activate and deactivate the phases as I hit the enemy till the enemy reaches the last phase, and then, with the last hit, I deactivate the enemy. The problem that I have is that when I activate each of the phases this creates a huge fps drop.
Each of the phases of the enemy has a NavMeshAgent. I have tried keeping all of them activated and just transforming the position and enabling the NaveMesh of the next phase as you hit the enemies but the NavMeshAgent gives a lot of errors.
The profiler lets me know that the problem is with the polymesh, but I don't know what to do to solve it. Any idea?
Is there any specific reason why you can'y have a single parent object with the Nav$$anonymous$$eshAgent attached and having the 4 phase objects children of that parent ? That would get rid of the need to enable / disable Agents at least.
Though out of curiosity - Any specific reason why you would have 4 different objects with their own logic and such ? If it's a matter of changing / updating the visuals, then why not just enable / disable the models while keeping everything else going ?