void createBuildingIconMap(int sizeX, int sizeY, Texture2D og) { buildingArr = new Color[sizeX, sizeY]; int xInd = 0; int yInd = 0; for (int x = (int)LevelController.me.playerFloor.bottomLeft.position.x; x < sizeX; x++) { for (int y = (int)LevelController.me.playerFloor.bottomLeft.position.y; y < sizeY; y++) { Vector3 worldPos = new Vector3(x, y, 0); RaycastHit2D[] rays = Physics2D.RaycastAll(worldPos, Vector2.zero, 1.0f); foreach (RaycastHit2D ray in rays) { if (ray.collider == null) { } else { if (ray.collider.gameObject.tag == "Walls") { /* MapIcon mi = ray.collider.gameObject.transform.parent.GetComponent<MapIcon> (); * if (mi == null) { * * } else { * try { * buildingArr [xInd, yInd] = mi.getNextPixel (); * } catch { * * } * }*/ } else { MapIcon mi = ray.collider.gameObject.transform.root.GetComponent <MapIcon> (); if (mi == null) { } else { try { buildingArr [xInd, yInd] = mi.getNextPixel(); } catch { } } } } } yInd++; } xInd++; yInd = 0; } Texture2D tex = new Texture2D(sizeX, sizeY, TextureFormat.RGBA32, false); for (int x = 0; x < sizeX; x++) { for (int y = 0; y < sizeY; y++) { if (buildingArr [x, y] == null || buildingArr[x, y] == Color.clear) { tex.SetPixel(x, y, og.GetPixel(x, y)); } else { tex.SetPixel(x, y, buildingArr [x, y]); } } } tex.filterMode = FilterMode.Point; tex.Apply(); mapBase = tex; }