public static void NewWorkspace() { if (WorkspaceView != null) { throw new Exception("BlocklyUI.NewWorkspace- there is already a workspace"); } Workspace workspace = new Workspace(new Workspace.WorkspaceOptions()); WorkspaceView = Object.FindObjectOfType <WorkspaceView>(); WorkspaceView.BindModel(workspace); UICanvas = WorkspaceView.GetComponentInParent <Canvas>(); }
public static void DestroyWorkspace() { if (WorkspaceView == null) { return; } WorkspaceView.Dispose(); if (WorkspaceView.gameObject != null) { GameObject.Destroy(WorkspaceView.gameObject); } WorkspaceView = null; }