private static void CreateRoomBlocks(GameObject parent, List <List <RoomBlock> > roomBlocks, Vector2 size) { foreach (var RB in roomBlocks) { int y = roomBlocks.IndexOf(RB); foreach (var rb in RB) { int x = RB.IndexOf(rb); int index = rb.BlockType; if (index != -1) { string ObjName = "Wall_" + index.ToString(); GameObject tempWall = PublicObj.Template.GetGameobject(ObjName); Vector3 pos = new Vector3(x * Offset_Wall, y * Offset_Wall, 0) + parent.transform.position; GameObject wall = MonoBehaviour.Instantiate(tempWall, pos, Quaternion.identity); wall.transform.parent = parent.transform; } } } }