QueueIncomingReliableWarning, hexagonal grid

So I create an hexagonal grid for movement in a turn based game at the start of the game on the master client with a chance of obstacles on it. But when a player joins the game just created the grid causes the player to get a QueueIncomingReliableWarning, probably because every hexagon has a PhotonView. But they all need a photon view to be instantiated and interacted with.

[code2=csharp]void createGrid ()
{
Vector2 gridSize = calcGridSize ();
GameObject hexGridGO = new GameObject ("HexGrid");
//board is used to store tile locations
Dictionary<Point, TileBehaviour> board = new Dictionary<Point, TileBehaviour> ();

for (float y = 0; y < gridSize.y; y++) {
float sizeX = gridSize.x;
//if the offset row sticks up, reduce the number of hexes in a row
if (y % 2 != 0 && (gridSize.x + 0.5) * hexWidth > groundWidth)
sizeX--;
for (float x = 0; x < sizeX; x++) {
GameObject hex = (GameObject)PhotonNetwork.Instantiate (Hex.name, Hex.transform.position, Hex.transform.rotation, 0);
Vector2 gridPos = new Vector2 (x, y);
hex.transform.position = calcWorldCoord (gridPos);
hex.transform.parent = hexGridGO.transform;
var tb = (TileBehaviour)hex.GetComponent ("TileBehaviour");
//y / 2 is subtracted from x because we are using straight axis coordinate system
tb.selectedTile = new Tile ((int)x - (int)(y / 2), (int)y);
board.Add (tb.selectedTile.Location, tb);
Transform objectslot = hex.transform.FindChild ("ObjectSlot");
if (objectslot != null) {
objectSlotsList.Add (objectslot.gameObject);
}
// every tile has a chance of spawning an obstacle on it
if (UnityEngine.Random.Range (0f, 1f) <= objectChance) {
GameObject PrefabToSpawn = objectPrefabs [UnityEngine.Random.Range (0, objectPrefabs.Count)];
Vector3 spawnpos = objectslot.position;
if (PrefabToSpawn.transform.name == "junk") {

spawnpos = new Vector3 (spawnpos.x, spawnpos.y, spawnpos.z - 0.9f);
}

GameObject newObstacle = (GameObject)PhotonNetwork.Instantiate (PrefabToSpawn.name, spawnpos, objectSlotsList [0].transform.rotation, 0);
newObstacle.transform.parent = objectslot;
objectSlotsList.Remove (objectslot.gameObject);
tb.selectedTile.Passable = false;
}
}
}
//variable to indicate if all rows have the same number of hexes in them
//this is checked by comparing width of the first hex row plus half of the hexWidth with groundWidth
bool equalLineLengths = (gridSize.x + 0.5) * hexWidth <= groundWidth;
//Neighboring tile coordinates of all the tiles are calculated
foreach (TileBehaviour tb in board.Values)
tb.selectedTile.FindNeighbours (board, gridSize, equalLineLengths);
}[/code2]

this is my code for creating the grid I know its kinda messy so I hope you can make something out of it, but this grid is really really important. So I need to get it to work. Any help would really be great

Comments

  • What exactly does not work? QueueIncomingReliableWarning does not necessarily means a problem.
    If you suspect that there are too much PhotonView's in scene, consider using one PhotonView for single 'Grid' object which manages all cells in game