public void GenerateGrid(){ Debug.Log("generate grid"); FactionManager factionManager=FactionManager.SetInstance(); if(factionManager!=null){ factionManager.ClearUnit(); factionManager.RecordSpawnTilePos(); //this is to record the tile of the spawn and deploy area } if(grid!=null) grid.ClearGrid(); if(tileType==_TileType.Hex){ grid=GridGenerator.GenerateHexGrid(width, length, tileSize, gridToTileRatio, unwalkableRate, gridColliderType); } else if(tileType==_TileType.Square){ grid=GridGenerator.GenerateSquareGrid(width, length, tileSize, gridToTileRatio, unwalkableRate, gridColliderType); } if(grid.gridObj!=null) grid.gridObj.transform.parent=transform.parent; if(factionManager!=null){ factionManager.SetStartingTileListBaseOnPos(tileSize*gridToTileRatio); //this is to set the tiles of the spawn and deploy area bsaed on the stored info earlier if(factionManager.generateUnitOnStart) factionManager._GenerateUnit(); } }