My projectils are randomly destroyed!

Hi,

I think it’s a bug, i have a space war game, when i have a lot of spaceships firing a lot of laser bullets, randomly all the laser are destroyed instantly at the same moment. It’s very strange, all the laser are an instance of a specific prefab, they are spheric litte balls they have a rigidbody, a collider, a trail renderer and a point light.

Is the game trying to avoid lag and destroy the objects for purpose?

I have tried many things but none of them worked.

Oh, one more thing : when i am on the editor screen it happen often when I select a bullet.

Unity will just let your frame-rate drop if you make too much stuff. It won’t just start destroying things.

One thing I’ve seen is sometimes code does things to the prefab, and not the spawned object:

// ex:
Transform T = Instantiate(frogPrefab, position, rotation);
  ....
Destroy(frogPrefab); // opps!! meant to destroy T

I dont know what happened but i think it’s a problem with the trail renderer. I removed it and it worked like a charm…

Ok i think i find out. When the fps are low, it seems that the trail renderer dont render. If autodestruc is activated, the game seems to delete de trail renderer when it’s not rendered.