bDisplayUnits
bDisplayUnits
#Overview
name: bDisplayUnits
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of bDisplayUnits is to control whether units are displayed on editor properties where the property has units set. This setting variable is part of the Unreal Editor’s project appearance settings and affects how numerical values are presented in the editor interface.
The bDisplayUnits variable is primarily used in the Unreal Editor subsystem, specifically within the EditorProjectSettings module. It’s a part of the UEditorProjectAppearanceSettings class, which inherits from UDeveloperSettings.
The value of this variable is set through the project settings in the Unreal Editor. It can be modified programmatically as seen in the code excerpt from EditorProjectSettings.cpp, where it’s set using the SetShouldDisplayUnits() function of a Settings object.
This variable interacts with other unit-related settings, such as DistanceUnits, ForceUnits, and PositionalImpulseUnits. It also has a related variable bDisplayUnitsOnComponentTransforms, which specifically controls unit display on component transform properties.
Developers should be aware that:
- This setting affects the visual representation of values in the editor, not the underlying data.
- It’s a project-wide setting that impacts all properties with units.
- Changing this setting will trigger a SaveConfig() call, persisting the change.
Best practices when using this variable include:
- Consider the target audience of your project. If it’s meant for technical users, displaying units might be helpful. For non-technical users, it might add unnecessary complexity.
- Ensure consistency across your project. If you enable unit display, make sure all relevant properties have appropriate units set.
- Be aware of performance implications. While likely minimal, displaying units on many properties could potentially impact editor performance in large projects.
- Use in conjunction with other unit-related settings for a comprehensive unit display strategy in your project.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditor.ini:523, section: [/Script/UnrealEd.EditorProjectAppearanceSettings]
- INI Section:
/Script/UnrealEd.EditorProjectAppearanceSettings
- Raw value:
True
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:133
Scope: file
Source code excerpt:
Settings.SetDisplayUnits(EUnitType::PositionalImpulse, PositionalImpulseUnits);
}
else if (Name == GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, bDisplayUnits))
{
Settings.SetShouldDisplayUnits(bDisplayUnits);
}
DefaultInputUnits_DEPRECATED = EDefaultLocationUnit::Invalid;
UnitDisplay_DEPRECATED = EUnitDisplay::Invalid;
SaveConfig();
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:164
Scope (from outer to inner):
file
function void UEditorProjectAppearanceSettings::PostInitProperties
Source code excerpt:
if (UnitDisplay_DEPRECATED != EUnitDisplay::Invalid)
{
bDisplayUnits = UnitDisplay_DEPRECATED != EUnitDisplay::None;
}
if (DefaultInputUnits_DEPRECATED != EDefaultLocationUnit::Invalid)
{
DistanceUnits.Empty();
DistanceUnits.Add(ConvertDefaultInputUnits(DefaultInputUnits_DEPRECATED));
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:183
Scope (from outer to inner):
file
function void UEditorProjectAppearanceSettings::PostInitProperties
Source code excerpt:
Settings.SetDisplayUnits(EUnitType::Force, ForceUnits);
Settings.SetShouldDisplayUnits(bDisplayUnits);
}
/* ULevelEditor2DSettings
*****************************************************************************/
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/Settings/EditorProjectSettings.h:69
Scope (from outer to inner):
file
class class UEditorProjectAppearanceSettings : public UDeveloperSettings
Source code excerpt:
UPROPERTY(EditAnywhere, config, Category=Units, meta=(DisplayName="Display Units on Applicable Properties", Tooltip="Whether to display units on editor properties where the property has units set."))
bool bDisplayUnits;
UPROPERTY(EditAnywhere, config, Category = Units, meta = (EditCondition="bDisplayUnits", DisplayName = "Display Units on Component Transforms", Tooltip = "Whether to display units on component transform properties"))
bool bDisplayUnitsOnComponentTransforms;
UPROPERTY(EditAnywhere, config, Category=Units, AdvancedDisplay, meta=(DisplayName="Distance/Length", Tooltip="Choose a set of units in which to display distance/length values."))
TArray<EUnit> DistanceUnits;