Enemy Spawner and Laser Problem/ Huge freeze frames/stuttering

My enemyCraft is not spawning all the way through a screen and not being destroyed by laser collision.


Also why does my entire level have such bad stutters.

@HUDSON_OPIELA_Studen I have found the following so far. Please have a look to this under PlayerLaser.


This is not the main cause but I have noticed this in others projects that are doing something similar. Two sections of the code seem to be causing the issue. Both are when you instantiate the objects enemy and when you press the space bar to fire.

If you go into the editor and turn off inputHandler script and enemySpawner you will see that the screen stutter will go away. Then if you go back in the editor and enable just the inputhandler you will see that every time you hit the space bar the screen will stutter.

I have forked the project and will see if I can have a deeper look.

hm, yeah I mean I had a feeling it had something to do with the script but I need that movement script and enemy spawner working in order for the actual game itself to function. Not sure what the actual fix would be to stop the stuttering while keeping the scripts enabled.

@HUDSON_OPIELA_Studen Yes that’s the idea but we must find the issue that is causing the hang up.

It’s because every enemy you spawn has a direction light in it. Every time you add a directional light to the scene, the material shaders will need to be recompiled. More directional lights means longer compile times and therefore stutters when you get lots of enemy ships.

Do you need the light? If so, consider using an omni or spotlight instead as they will be far cheaper when using clustered lighting. Or delete it from the template if you don’t need them.

Also check that you are using the right template for the spawner. You have two templates called ‘EnemyShip’ so make sure that the right one is being used.

1 Like