Random hex grid

I’d like to be able to make hexagon prefabs spawn randomly but next to each other, to make some sort of grid. That way, each time the game starts, the player would get a different grid. I really don’t know how to approach this.

Any suggestions would be much appreciated, thanks!

well, one thing you could do is make your prefabs, then spawn one, and do a random number between 1-6. Then add another hex to that side of the one you have. then random again, and add one to the new hex, and so forth. If you get a side that’s already taken with the random number, then pick a different side, etc.

Pretty basic but it might get you going.

If you are looking for the same map, but different arrangements of grid, I will propose that you should manually make a generic map prefab (with a bunch of empty objects placed in a hexagonal patterns). Then on game start, you will randomly place different hexagons grid on each of these locations:

public Hexagon[] hexs;   //Manully assigned
public Transform[] arrangement; //Manually assigned

private List <Hexagon> tiles = new List<Hexagon>();
void Start() {

   for( int i = 0; i < arrangement.Length; ++i ) {
      Hexagon newHex = Instantiate( hexs[ Random.Range(0, hexs.length) ], arrangement_.position, arrangement*.rotation);*_

tiles.Add(newHex); // This is optionally
Side note:
Assuming you have 1 blue tile, 1 red tile, and 1 green tile. And you need their ratio to be 7:2:1; in the inspector, you will put in 8 blue tile prefabs, 1 red and 1 green in the hexs variable.
For arrangement, you can either do it programmatically(can adapt to different map) or manually(cheap & quick solution)