- Home /
How to represent a dynamic tile like map in Unity
I am not that familiar with unity and my question is quite newbish in terms of what I want to accomplish which is a game that I can represent and interact with like a tiled based system
to help understand I have an example:
I have a 3x3 block of gameobjects on top of a single 'floor' gameobject which represents a 3x3 game 'map'
the functionality I have is as follows.
if I click on the game object I wish to destroy, it is destroyed using the following code
if (Input.GetButtonDown("Fire1"))
{
RaycastHit hit;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, out hit, 100.0f))
{
Debug.DrawLine(Camera.main.ScreenPointToRay (Input.mousePosition).origin, hit.point);
GameObject.Destroy( hit.collider.gameObject);
}
}
Here are the before and after screenshots
before
after
my question is how can I replicate this functionality using a 256x256 map where I am not using GameObjects (as I cant use 65536 game objects to represent my map). The 'wall' sections need to be collidable. I'm quite stuck with this problem and I'm not particularly sure what I should be even searching for to get answers.
I'll update the post as required as I'm not sure how to explain this better.
Thanks for taking the time
Because a picture explains a thousand words using my modest talent at Microsoft Paint I have done an artistic impression of what the tile based map 'thingy' would look like if I carved a 3x3 hole in the middle of the map with the camera looking down it.
Edit: It wont let me put more than two pictures up so my artistic talent will have to wait another day
Answer by VesuvianPrime · Dec 12, 2014 at 02:29 AM
You're going to need to get very friendly with procedural geometry generation and the Mesh class.
Take a look at the Jarheads game.
Thanks, I'll be taking a look starting there but I'll hold off accepting answer to see if I can get a few sources. Fingers crossed eh
Your answer
![](https://koobas.hobune.stream/wayback/20220613173837im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How would you convert 3D terrain into a 2D tilemap? 1 Answer
Pixel-Perfect Tilemaps on 3d objects (SabreCSG) 0 Answers
Unity Probuilder mesh brush and grids. 0 Answers
Can I tilemap with 3d prefabs 0 Answers
Creating a 3D Looping Map 1 Answer