public static void CreateRuntimeEditor(GameObject commandsPanel, string name) { if (!Object.FindObjectOfType <EventSystem>()) { GameObject es = new GameObject(); es.AddComponent <EventSystem>(); es.AddComponent <StandaloneInputModule>(); es.name = "EventSystem"; } GameObject go = new GameObject(); go.name = name; SplineRuntimeEditor srtEditor = go.AddComponent <SplineRuntimeEditor>(); GameObject uiEditorGO = RTEditorMenu.InstantiateRuntimeEditor(); uiEditorGO.transform.SetParent(go.transform, false); RuntimeEditor rtEditor = uiEditorGO.GetComponent <RuntimeEditor>(); UnityEventTools.AddPersistentListener(rtEditor.Closed, new UnityAction(srtEditor.OnClosed)); Placeholder[] placeholders = uiEditorGO.GetComponentsInChildren <Placeholder>(true); Placeholder cmd = placeholders.Where(p => p.Id == Placeholder.CommandsPlaceholder).First(); commandsPanel.transform.SetParent(cmd.transform, false); Undo.RegisterCreatedObjectUndo(go, "Battlehub.Spline.CreateRuntimeEditor"); }
private void on_click() { var lang = State.Language; if (lang == null) { return; } var demo = Demo && Application.isEditor; RuntimeEditor.Load(demo, lang, Arena.None); }