void AddInitialCharacters() { for (int i = 0; i < CharacterSpawner.instance.characterDatas.Count; i++) { CharacterCreationPanel p = Instantiate(characterCreationPrefab, characterCreationParent).GetComponent <CharacterCreationPanel>(); p.SetContent(CharacterSpawner.instance.characterDatas[i]); } }
private void Awake() { if (instance == null) { //...set this one to be it... instance = this; } //...otherwise... else if (instance != this) { //...destroy this one because it is a duplicate. Destroy(gameObject); } }
public void NewCharacter() { CharacterCreationPanel p = Instantiate(characterCreationPrefab, characterCreationParent).GetComponent <CharacterCreationPanel>(); p.SetContent(CharacterSpawner.instance.NewCharacter()); }