TimeUnits

TimeUnits

#Overview

name: TimeUnits

The value of this variable can be defined or overridden in .ini config files. 2 .ini config files referencing this setting variable.

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of TimeUnits is to specify the units used for displaying time-related data in various parts of the Unreal Engine editor and related tools. It is primarily used for configuring how time values are presented to users in the editor interface and debugging tools.

This setting variable is utilized by several Unreal Engine subsystems and modules:

  1. The Niagara visual effects system, specifically in the Niagara Editor and Debugger.
  2. The Editor Project Settings, which affect the overall editor configuration.

The value of this variable is set in the Editor Project Settings, as seen in the UEditorProjectAppearanceSettings class. It can be modified through the editor interface or programmatically.

TimeUnits interacts with other unit-related variables such as DistanceUnits, MassUnits, AngleUnits, SpeedUnits, TemperatureUnits, and ForceUnits. These variables collectively define the unit display preferences for various physical quantities in the editor.

Developers should be aware that:

  1. Changing this variable affects how time values are displayed across multiple tools and interfaces.
  2. The available options for TimeUnits include Milliseconds, Seconds, Minutes, Hours, Days, Months, and Years.
  3. This setting is part of the editor configuration and does not directly affect runtime behavior of games.

Best practices when using this variable include:

  1. Choosing a time unit that is most appropriate for the scale of your project. For example, using milliseconds for very short time spans or years for long-term simulations.
  2. Ensuring consistency across your project by using the same time units in custom tools or scripts that interact with the engine.
  3. Considering the needs of your development team when setting this value, as it affects the readability and interpretation of time-related data in the editor.
  4. Being aware that changing this setting may require adjustments in how team members interpret time values displayed in the editor and debugging tools.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditor.ini:526, section: [/Script/UnrealEd.EditorProjectAppearanceSettings]

Location: <Workspace>/Engine/Config/BaseEditor.ini:527, section: [/Script/UnrealEd.EditorProjectAppearanceSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Customizations/NiagaraOutlinerCustomization.cpp:666

Scope (from outer to inner):

file
class        class SNiagaraOutlinerTreeItemHeaderDataWidget<FNiagaraOutlinerTimingData> : public SCompoundWidget
function     void Construct

Source code excerpt:

		float RTVal = Data.RenderThread;

		if (ViewSettings.TimeUnits == ENiagaraOutlinerTimeUnits::Milliseconds)
		{
			GTVal /= 1000.0f;
			RTVal /= 1000.0f;
		}
		else if (ViewSettings.TimeUnits == ENiagaraOutlinerTimeUnits::Seconds)
		{
			GTVal /= 1000000.0f;
			RTVal /= 1000000.0f;
		}

		FText GameThread = FText::AsNumber(GTVal);

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/NiagaraOutliner.h:107

Scope: file

Source code excerpt:

	/** Units used to display time data in performance view mode. */
	UPROPERTY(EditAnywhere, Category = "View")
	ENiagaraOutlinerTimeUnits TimeUnits = ENiagaraOutlinerTimeUnits::Microseconds;

	FORCEINLINE ENiagaraOutlinerSortMode GetSortMode()
	{
		if (SortMode == ENiagaraOutlinerSortMode::Auto)
		{
			return ViewMode == ENiagaraOutlinerViewModes::State ? ENiagaraOutlinerSortMode::FilterMatches : ENiagaraOutlinerSortMode::AverageTime;

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebugger.cpp:595

Scope (from outer to inner):

file
namespace    NiagaraOutlinerTab
function     static TSharedRef<SWidget> MakeOutlinerToolbar
lambda-function

Source code excerpt:

					if (Debugger.IsValid() && Enum)
					{
						ENiagaraOutlinerTimeUnits TimeUnits = Debugger->GetOutliner()->ViewSettings.TimeUnits;
						return Enum->GetDisplayNameTextByValue((int32)TimeUnits);
					}
					return FText::GetEmpty();
				};
				auto GetUnitsMenu = [Debugger]()
				{
					FMenuBuilder MenuBuilder(true, NULL);

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/Widgets/SNiagaraDebugger.cpp:612

Scope (from outer to inner):

file
lambda-function
lambda-function

Source code excerpt:

								if (Debugger.IsValid())
								{
									Debugger->GetOutliner()->ViewSettings.TimeUnits = NewMode;
									Debugger->GetOutliner()->OnChanged();
								}
							}));
							MenuBuilder.AddMenuEntry(Enum->GetDisplayNameTextByIndex(i), Enum->GetToolTipTextByIndex(i), FSlateIcon(), ItemAction);
						}
					}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:93

Scope (from outer to inner):

file
function     void UEditorProjectAppearanceSettings::PostEditChangeProperty

Source code excerpt:

		Settings.SetDisplayUnits(EUnitType::Mass, MassUnits);
	}
	else if (Name == GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, TimeUnits))
	{
		Settings.SetDisplayUnits(EUnitType::Time, TimeUnits);
	}
	else if (Name == GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, AngleUnits))
	{
		Settings.SetDisplayUnits(EUnitType::Angle, AngleUnits);
	}
	else if (Name == GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, SpeedUnits))

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:160

Scope (from outer to inner):

file
function     void UEditorProjectAppearanceSettings::PostInitProperties

Source code excerpt:

	SetupEnumMetaData(GetClass(), GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, DistanceUnits), TEXT("Micrometers, Millimeters, Centimeters, Meters, Kilometers, Inches, Feet, Yards, Miles"));
	SetupEnumMetaData(GetClass(), GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, MassUnits), TEXT("Micrograms, Milligrams, Grams, Kilograms, MetricTons,	Ounces, Pounds, Stones"));
	SetupEnumMetaData(GetClass(), GET_MEMBER_NAME_CHECKED(UEditorProjectAppearanceSettings, TimeUnits), TEXT("Milliseconds, Seconds, Minutes, Hours, Days, Months, Years"));

	if (UnitDisplay_DEPRECATED != EUnitDisplay::Invalid)
	{
		bDisplayUnits = UnitDisplay_DEPRECATED != EUnitDisplay::None;
	}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Settings/EditorProjectSettings.cpp:177

Scope (from outer to inner):

file
function     void UEditorProjectAppearanceSettings::PostInitProperties

Source code excerpt:

	Settings.SetDisplayUnits(EUnitType::Distance, DistanceUnits);
	Settings.SetDisplayUnits(EUnitType::Mass, MassUnits);
	Settings.SetDisplayUnits(EUnitType::Time, TimeUnits);
	Settings.SetDisplayUnits(EUnitType::Angle, AngleUnits);
	Settings.SetDisplayUnits(EUnitType::Speed, SpeedUnits);
	Settings.SetDisplayUnits(EUnitType::Temperature, TemperatureUnits);
	Settings.SetDisplayUnits(EUnitType::Force, ForceUnits);

	Settings.SetShouldDisplayUnits(bDisplayUnits);

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Public/Settings/EditorProjectSettings.h:81

Scope (from outer to inner):

file
class        class UEditorProjectAppearanceSettings : public UDeveloperSettings

Source code excerpt:


	UPROPERTY(EditAnywhere, config, Category=Units, AdvancedDisplay, meta=(DisplayName="Time", Tooltip="Choose the units in which to display time."))
	TArray<EUnit> TimeUnits;
	
	UPROPERTY(EditAnywhere, config, Category=Units, AdvancedDisplay, meta=(DisplayName="Angles", Tooltip="Choose the units in which to display angles.", ValidEnumValues="Degrees, Radians"))
	EUnit AngleUnits;

	UPROPERTY(EditAnywhere, config, Category=Units, AdvancedDisplay, meta=(DisplayName="Speed/Velocity", Tooltip="Choose the units in which to display speeds and velocities.", ValidEnumValues="CentimetersPerSecond, MetersPerSecond, KilometersPerHour, MilesPerHour"))
	EUnit SpeedUnits;