private void DrawAddPlayerBox() { if (_currentlyEdited == null || (_currentlyEdited.playerName == "" && _currentlyEdited.customId == 0)) { _currentlyEdited = PlayerTemplate.CreateNewPlayer(true); } PlayerTemplateEditor.DrawPlayerTemplate(_currentlyEdited); SimpleGUI.ActionButton("Add player", () => { _controller.Emulator.SpawnPlayer(GotoUdonSettings.Instance, _currentlyEdited); _currentlyEdited = PlayerTemplate.CreateNewPlayer(true); }); }
private void DrawTemplatesEditor() { EditorGUI.BeginChangeCheck(); DrawGlobalOptions(GotoUdonSettings.Instance); SimpleGUI.SectionSpacing(); #if GOTOUDON_SIMULATION_LEGACY List <PlayerTemplate> templates = GotoUdonSettings.Instance.playerTemplates; if (templates.Count == 0) { templates.Add(PlayerTemplate.CreateNewPlayer(true)); } GUILayout.Label("Players to create at startup:"); PlayerTemplate toRemove = null; foreach (var template in templates) { if (PlayerTemplateEditor.DrawPlayerTemplateWithRemoveButton(template)) { toRemove = template; } SimpleGUI.OptionSpacing(); } templates.Remove(toRemove); if (templates.Count == 0) { templates.Add(PlayerTemplate.CreateNewPlayer(true)); } SimpleGUI.ActionButton("Add another player", () => templates.Add(PlayerTemplate.CreateNewPlayer(templates.Count == 0))); SimpleGUI.SectionSpacing(); if (SimpleGUI.EndChangeCheck()) { EditorUtility.SetDirty(GotoUdonSettings.Instance); } SimpleGUI.InfoBox(true, "In play mode you will be able to control all created players here, or add more"); #endif }