Help! My game level won't open!

The level won’t open and is VERY in laggy in the editor.


I could DM anyone the link because the game is private but the level literally won’t open anymore because of all these blocks.

Is there a way I could avoid this?

The blocks spawn a tilemapped block in their place and get destroyed and send a message to choose which tilemap the block will spawn with.

If you’re spawning the blocks and destroying the old ones, no collisions are being merged. I’d very much recommend you look into JR’s tile map example.

So basically;
In the editor, you’re probably lagging because it’s just a weaker device, not a ton to do there.

While the game is running, there are a few things

  1. Collisions aren’t merged because of the Destroy behavior, and the spawned objects also aren’t merged.
  2. Sending messages like that and destroying a ton of objects (I’m assuming you’re also using Ray Casts) aren’t great for performance.
  3. On another note for merging collisions, in the image you sent you’ll see that you have a lot of rounded corners outside side of what the players see. If collisions did merge, you’d want to square that off so they group together better.
1 Like

I used JR01’s Tilemap example which is how I made a tilemap in the first place.
I didn’t know that collisions could be merged so I’ll make sure that the edges are sqaured if they need to be.
Here’s the code for the blocks I was talking about:


It spawns the ground block (which has tilemaps) and messages the ground block a number, the number being which tilemap to choose, after it chooses the number and sends it, it gets destroyed.

Is any of this code ruining my game?

Also I got the level to run but now it just takes a bit of more time compared to when it loaded instantly.

1 Like

There is probable too many blocks spawning at once, causing the lag. If you can go into the editor, maybe try using an InView instead of a once?

1 Like

True!

1 Like

This happens if I use in-view…

1 Like

Did you refresh? Or is it just not working for some reason?

1 Like

I’m pretty sure it’s getting confused or something, since JR01’s tilemap example probably wasn’t supposed to be used that way.

1 Like

I’m not getting why you’re spawning the ground. And like I previously said, spawned objects won’t have their collisions merged either way.

I’m spawning it because I’m too lazy to make a second object for seperate tilemaps, so my idea was that instead of making yet another block for another specific tilemap I could just make multiple tilemaps in the same ground block and have messages to be sent to them to choose a specific tilemap. So then I could have “different blocks” by using this trick, and most of the raycasts in my player for the platformer code only specifically check for the ground block only.

You can still message them, just don’t destroy them and spawn in a new one.

1 Like