private void InstantiateFields() { var i = 0; foreach (var field in _gameBoard.Fields) { var fieldView = _itemPool.GetField(); // Find the node at the field's position and set it as a parent of this field fieldView.transform.SetParent(NodeMap[field.Position].transform); fieldView.Init(field, NodeMap[field.Position], NodeMap[field.ConnectedPosition]); fieldView.name = "Field " + i++; // Keep track of the field in grid space // Since fields are undirected, we should add the opposite direction as well FieldMap.Add(field.Position, field.Direction, fieldView); FieldMap.Add(field.ConnectedPosition, field.Direction.Opposite(), fieldView); } }