Replicators should not spawn objects in 1 frame

replicators should not spawn objects so fast. im making a tower defence game and every time enemy spawns it lags and in mobile it is so slow.

1 Like

That could be the issue with what object you replicate or how many executions you make at the time

1 Like

The replicator should spawn an object as soon as possible. Here’s a fix that could minimize the lag you’re experiencing.

If you haven’t already, the replicator has an option to preallocate copies during the loading screen. This can reduce hitching if you know you’ll use a certain amount of copies inside a replicator.

If your still experiencing lag, you can try spawning in batches of copies that would be used in a round and set their position far below the map until their are ready to be used. Then return them to the replicator once the round is over. This has fixed the small amount of lag I experience in my rooms when the replicator spawns any kind of copy.

Hope this helps!

4 Likes

I ran into issue with preallocating - I have cca 12 replicators, all set to 30-50 copies preallocated. Now the loading screen stucks at 100% for several minutes before loading the room.

Yes, that will happen if you pre-allocated that many objects.

Your room is currently trying to allocate 480 objects before loading, are you absolutely sure you will need those right away? You should only pre-allocate objects if they will be used immediately or very often. Any other objects should be replicated normally.

I am working on procedurally generated obstacle course and procedurally generated maze. When the thing is being generated it introduces unbearable lags. So I tried to ease it with pregeneration