public override VisualElement CreateInspectorGUI() { root = new VisualElement(); VisualElement selectorContainer = new VisualElement() { style = { flexDirection = FlexDirection.Row, alignItems = Align.Stretch, justifyContent = Justify.FlexStart } }; //Status text/character statusLabel = new Label() { text = "?", style = { width = 20 //Constant width to stop the selector from moving } }; selectorContainer.Add(statusLabel); root.Add(selectorContainer); //Microphone source dropdown ToolbarMenu menu = new ToolbarMenu(); menu.menu.AppendAction("Off", OnSourceSelect, (a) => DropdownMenuAction.Status.Normal, null); menu.menu.AppendAction("Default Device", OnSourceSelect, (a) => DropdownMenuAction.Status.Normal, null); foreach (string deviceName in Microphone.devices) { menu.menu.AppendAction(deviceName, OnSourceSelect, (a) => DropdownMenuAction.Status.Normal, null); } menuLabel = new Label() { text = "---" }; menu.Add(menuLabel); selectorContainer.Add(menu); //Sample rate label sampleFrequencyLabel = new Label() { text = "@ ???Hz" }; root.Add(sampleFrequencyLabel); Refresh(); editorTarget.DeviceStateChanged += Refresh; //Refresh when the device changes return(root); }