public void Setup(MyRoomData data) { this.mydata = data; this.roomName.text = data.room_name; GameObject newOffice = (GameObject)GameObject.Instantiate(targetPrefab); newOffice.transform.position = new Vector3(mydata.xCoord, mydata.yCoord, mydata.zCoord); targetDestination = newOffice.transform; RoomObject prefab = newOffice.GetComponent <RoomObject>(); prefab.Setup(data); GameObject child = newOffice.transform.GetChild(0).gameObject; TextMeshPro roomName = child.GetComponent <TextMeshPro>(); roomName.text = data.room_name; if (data.location == "B") { newOffice.layer = 12; child.layer = 12; } else if (data.location == "G") { newOffice.layer = 13; child.layer = 13; } else if (data.location == "S") { newOffice.layer = 14; child.layer = 14; } }