Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How to: hexagonal tile grid without simply instantiating a tile prefab many times

Discussion in 'Editor & General Support' started by Piesk, Dec 6, 2013.

  1. Piesk

    Piesk

    Joined:
    Sep 23, 2013
    Posts:
    14
    I am fairly new to unity and as such ran into a fairly obvious (but fundamentally massive) problem. I am working on a turn based strategy game. In order to make the map i followed several guides that instructed to take a hexagon tile prefab and essentially instantiate it many times to create your grid.

    my problem is my large map is 150 x 150 tiles........ 22500 tiles all with mesh colliders is not really feasible. (not to mention takes an age to procedurally generate. It's pretty obvious that commercial games out there are not doing what I am doing, so how the heck do i get a tile based map of potentially large proportions without simple instantiating a prefab 22500 times?

    Thanks in advance for any help
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use the Mesh class to generate mesh chunks that contain many tiles each, which will be far more performant. I think there are some assets on the store that do hex tiles.

    --Eric
     
  3. Piesk

    Piesk

    Joined:
    Sep 23, 2013
    Posts:
    14
    indeed after months of searching for a different way i discovered a bunch of tutorials to make tile based grid system using a single mesh. However no hex grid tutorials as of yet, unfortunately I cannot spend the $$ in the asset store at this time.