public void AddMatch(RoomInfo roomInfo) { GameObject go = Instantiate(matchPrefab); go.transform.SetParent(matchesParent); MatchSpawnPosition p = GetSpawnPos(); p.isUsed = true; go.transform.position = p.pos.position; go.transform.localScale = Vector3.one; RoomButton roomButton = go.GetComponent <RoomButton>(); roomButton.roomInfo = roomInfo; roomButton.isRoomCreated = true; roomButton.isValid = true; roomButton.room = ScriptableObject.CreateInstance <Room>(); object sceneObj = null; roomInfo.CustomProperties.TryGetValue("scene", out sceneObj); string sceneName = (string)sceneObj; roomButton.room.sceneName = sceneName; roomButton.room.roomName = roomInfo.Name; roomsDict.Add(roomInfo.Name, roomButton); }
// Use this for initialization private void Start() { Transform[] p = spawnParent.GetComponentsInChildren <Transform>(); foreach (Transform t in p) { if (t != spawnParent) { MatchSpawnPosition m = new MatchSpawnPosition(); m.pos = t; spawnPos.Add(m); } } }