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

Best Way to Create Hexagon Tiles for a Hex Mesh

Discussion in 'General Graphics' started by Phanixis, Feb 2, 2016.

  1. Phanixis

    Phanixis

    Joined:
    Oct 19, 2015
    Posts:
    27
    I want to create a hexmap for a strategy game. To do that, I want to make a hexagon tile prefab. Ideally, this object would be transparent accept for the boarders, although the object does need to be a complete solid hexagon for UI purposes. As none of the 2d or 3d default objects in unity provide are hexagons, what would be the best way to go about creating a hexagon tile graphic for a hexagon prefab?

    Thanks for the help.
     
    Last edited: Feb 2, 2016
  2. gristly

    gristly

    Joined:
    Jan 14, 2015
    Posts:
    16
    Is your game 2D or 3D? If it is 2D, you can use a program such as Photoshop or GIMP (which is very similar to photoshop but totally free) to create this graphic yourself. There are tons and tons of tutorials online. If you want an actual 3D hexagon, a 3D modeling program like Blender (again free, with many tutorials online) would be your best bet.
     
  3. Phanixis

    Phanixis

    Joined:
    Oct 19, 2015
    Posts:
    27
    The game will be in 3D.

    Am I going to need to make a hollow 3d model of a hexagon, or is there a way to make the model transparent and have only the edges outlined so that you are only seeing the hexagon borders?

    How about drawing a model using code? It's just six lines connected six vertices. The only problem I see here is I want each tile to independently register mouse clicks.

    Thanks for the help.
     
  4. gristly

    gristly

    Joined:
    Jan 14, 2015
    Posts:
    16
    Oh man I totally disappeared for a while, sorry about that. Maybe you've already figured this out but I'll reply just in case. You can make a regular hexagonal model, and then use a translucent texture, yes. Just set the texture on the Material on the hexagon to Fade. Drawing using code would be possible, but could be tedious.