void EditTile(int x, int y) { if (x < 0 || y < 0 || x >= Room.gridWidth || y >= Room.gridHeight) { return; } DungeonTile oldTile = loadedRoom.contents.GetTile(x, y); if (oldTile != null) { Destroy(oldTile.gameObject); } DungeonTile newTile = null; if (activeTile != null) { GameObject _newTile = PrefabUtility.InstantiatePrefab(activeTile.gameObject) as GameObject; newTile = _newTile.GetComponent <DungeonTile>(); newTile.transform.SetParent(loadedRoom.transform); newTile.x = x; newTile.y = y; Vector2 postion; postion.x = x - Room.gridWidth / 2f + .5f; postion.y = y - Room.gridHeight / 2f + .5f; newTile.transform.position = loadedRoom.transform.TransformPoint(postion); newTile.room = loadedRoom; newTile.EnableDebug(); } loadedRoom.contents.SetTile(newTile, x, y); }