How to place tilemap for Sandbox Game?

I’m making sandbox game & I need help on making script for tilemaps,
I want make a Brush tool/Custom Tilemap for my sandbox game, Just like this Worldbox Game.

Please share me some script for this, I’ve been searching for this but I doesn’t found anything.

@RexCodeOfficial

“Please share me some script for this, I’ve been searching for this but I doesn’t found anything.”

No-one is most likely going to find / create a script for you that matches your requirements. This is not a get a script service, but a forum. There are several examples that will show you how to do what you want, if you just do some searches.

This page is your best friend:

And these are the steps you need at least:

  • How to get mouse position in screen space; Camera.ScreenToWorldPoint.
  • How to convert world position to a tilemap position; WorldToCell, WorldToLocal.
  • How to add or remove tiles; SetTile or SetTiles.
  • To get circular area, you can first find out rectangular area of tiles around you click, then iterate those tiles, calculate distance to click to see if that tile fits inside a circle of defined radius. If it does, then collect it to a list.
  • Finally, set the collected tiles defining a circular area with your selected tile prefab. You can use this method to create circular explosion and paintbrush effects.
1 Like

@RexCodeOfficial

Why remove the video? By removing the video, you somewhat make the answer less understandable… it is not like the video costs something to you, it was hosted by YouTube anyway…

I’m sorry, Do want me to return it back? If yes I will do it now.

Anyways can I do that on Bolt?

@RexCodeOfficial

Well if it bothers you for some reason then don’t, but in general, my point was if someone reads this thread later, it would have been slightly more understandable what we were talking about.

2 Likes

“Anyways can I do that on Bolt?”

Missed this part of your question. I have no idea. I know Bolt is now free so I might test Bolt now… but based on what I’ve used tile maps, I would imagine doing something like this in visual scripting would require way more effort than doing tilemap manipulation in C#, using a couple of for loops and above mentioned Unity API commands.

Ok, Thanks @eses , I’ll try it too, & I also try all the steps you give to me, have a great time!

1 Like

@eses I made i using Bolt now I only need to wait for bolt 2 to generate c# code, I’m now making it on c# your steps our awesome!

1 Like