private void ConfigureFields() { // Using MandatoryQ instead of just Q to make sure modifications of the UXML file don't make the // necessary elements disappear unintentionally. m_ThemeStyleSheetField = m_RootVisualElement.MandatoryQ <ObjectField>("themeStyleSheet"); m_ThemeStyleSheetField.objectType = typeof(StyleSheet); // We have decided to hide the setting of the style sheet until themes are available so we can // prevent some misunderstandings happening with people removing the style sheet or replacing // with a local one that does not have all the basic styles necessary defined. m_ThemeStyleSheetField.style.display = DisplayStyle.None; m_UITKTextSettings = m_RootVisualElement.MandatoryQ <ObjectField>("textSettings"); m_UITKTextSettings.objectType = typeof(PanelTextSettings); m_TargetTextureField = m_RootVisualElement.MandatoryQ <ObjectField>("targetTexture"); m_TargetTextureField.objectType = typeof(RenderTexture); m_ScaleModeField = m_RootVisualElement.MandatoryQ <EnumField>("scaleMode"); m_ScreenMatchModeField = m_RootVisualElement.MandatoryQ <EnumField>("screenMatchMode"); m_ScaleModeConstantPixelSizeGroup = m_RootVisualElement.MandatoryQ("scaleModeConstantPixelSize"); m_ScaleModeScaleWithScreenSizeGroup = m_RootVisualElement.MandatoryQ("scaleModeScaleWithScreenSize"); m_ScaleModeContantPhysicalSizeGroup = m_RootVisualElement.MandatoryQ("scaleModeConstantPhysicalSize"); m_ScreenMatchModeMatchWidthOrHeightGroup = m_RootVisualElement.MandatoryQ("screenMatchModeMatchWidthOrHeight"); m_ClearColorField = m_RootVisualElement.MandatoryQ <PropertyField>("clearColor"); m_ColorClearValueField = m_RootVisualElement.MandatoryQ <PropertyField>("colorClearValue"); var choices = new List <int> { 0, 1, 2, 3, 4, 5, 6, 7 }; var targetDisplayField = new PopupField <int>("Target Display", choices, 0, i => $"Display {i + 1}", i => $"Display {i + 1}"); targetDisplayField.bindingPath = "m_TargetDisplay"; m_TargetTextureField.parent.Add(targetDisplayField); targetDisplayField.PlaceInFront(m_TargetTextureField); m_SortOrderField = m_RootVisualElement.MandatoryQ <FloatField>("sortingOrder"); m_SortOrderField.isDelayed = true; }
private void ConfigureFields() { // Using MandatoryQ instead of just Q to make sure modifications of the UXML file don't make the // necessary elements disappear unintentionally. m_MissingThemeHelpBox = m_RootVisualElement.MandatoryQ <HelpBox>("missing-theme-warning"); m_ThemeStyleSheetField = m_RootVisualElement.MandatoryQ <ObjectField>("theme-style-sheet"); m_ThemeStyleSheetField.objectType = typeof(ThemeStyleSheet); m_UITKTextSettings = m_RootVisualElement.MandatoryQ <ObjectField>("text-settings"); m_UITKTextSettings.objectType = typeof(PanelTextSettings); m_TargetTextureField = m_RootVisualElement.MandatoryQ <ObjectField>("target-texture"); m_TargetTextureField.objectType = typeof(RenderTexture); m_ScaleModeField = m_RootVisualElement.MandatoryQ <EnumField>("scale-mode"); m_ScreenMatchModeField = m_RootVisualElement.MandatoryQ <EnumField>("screen-match-mode"); m_ScaleModeConstantPixelSizeGroup = m_RootVisualElement.MandatoryQ("scale-mode-constant-pixel-size"); m_ScaleModeScaleWithScreenSizeGroup = m_RootVisualElement.MandatoryQ("scale-mode-scale-with-screen-size"); m_ScaleModeContantPhysicalSizeGroup = m_RootVisualElement.MandatoryQ("scale-mode-constant-physical-size"); m_ReferencePixelsPerUnit = m_RootVisualElement.MandatoryQ("reference-pixels-per-unit"); m_ScreenMatchModeMatchWidthOrHeightGroup = m_RootVisualElement.MandatoryQ("screen-match-mode-match-width-or-height"); m_ClearColorField = m_RootVisualElement.MandatoryQ <PropertyField>("clear-color"); m_ColorClearValueField = m_RootVisualElement.MandatoryQ <PropertyField>("color-clear-value"); var choices = new List <int> { 0, 1, 2, 3, 4, 5, 6, 7 }; var targetDisplayField = new PopupField <int>("Target Display", choices, 0, i => $"Display {i + 1}", i => $"Display {i + 1}"); targetDisplayField.bindingPath = "m_TargetDisplay"; m_TargetTextureField.parent.Add(targetDisplayField); targetDisplayField.PlaceInFront(m_TargetTextureField); }