bEnableEditorSounds

bEnableEditorSounds

#Overview

name: bEnableEditorSounds

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of bEnableEditorSounds is to control whether audio feedback is enabled for certain operations in the Unreal Editor, such as entering and exiting Play mode. This setting variable is part of the editor’s audio feedback system.

The Unreal Engine subsystem that relies on this setting variable is primarily the UnrealEd module, specifically within the editor’s sound playback functionality. This can be seen from the references in the EditorEngine.cpp file.

The value of this variable is set in the LevelEditorMiscSettings class, which inherits from UDeveloperSettings. This suggests that it can be configured through the editor’s project settings interface.

The bEnableEditorSounds variable interacts with other functions in the EditorEngine class, particularly PlayEditorSound() and CanPlayEditorSound(). These functions check the value of bEnableEditorSounds before playing editor sounds or determining if sounds can be played.

Developers must be aware that this variable is a bitfield (uint32 bEnableEditorSounds:1), which means it’s a boolean flag stored efficiently within a 32-bit integer. They should also note that this setting affects the editor experience and not the game itself.

Best practices when using this variable include:

  1. Respecting the user’s preference for editor sounds and not overriding this setting without good reason.
  2. Using the CanPlayEditorSound() function to check if sounds can be played before attempting to play them.
  3. Considering the impact on user experience when adding new editor sounds, and ensuring they are tied to this setting.
  4. Documenting any new uses of this variable to maintain consistency across the editor’s audio feedback system.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:216, section: [/Script/UnrealEd.LevelEditorMiscSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Classes/Settings/LevelEditorMiscSettings.h:70

Scope (from outer to inner):

file
class        class ULevelEditorMiscSettings : public UDeveloperSettings

Source code excerpt:

	/** Enables audio feedback for certain operations in Unreal Editor, such as entering and exiting Play mode */
	UPROPERTY(EditAnywhere, config, Category=Sound)
	uint32 bEnableEditorSounds:1;

public:

	/** The default level streaming class to use when adding new streaming levels */
	UPROPERTY(EditAnywhere, config, Category=Levels)
	TSubclassOf<ULevelStreaming> DefaultLevelStreamingClass;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:2768

Scope (from outer to inner):

file
function     void UEditorEngine::PlayEditorSound

Source code excerpt:

{
	// Only play sounds if the user has that feature enabled
	if( !GIsSavingPackage && IsInGameThread() && GetDefault<ULevelEditorMiscSettings>()->bEnableEditorSounds )
	{
		USoundBase* Sound = Cast<USoundBase>( StaticFindObject( USoundBase::StaticClass(), NULL, *SoundAssetName ) );
		if( Sound == NULL )
		{
			Sound = Cast<USoundBase>( StaticLoadObject( USoundBase::StaticClass(), NULL, *SoundAssetName ) );
		}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/EditorEngine.cpp:2797

Scope (from outer to inner):

file
function     bool UEditorEngine::CanPlayEditorSound

Source code excerpt:

bool UEditorEngine::CanPlayEditorSound() const
{
	return IsInGameThread() && GetDefault<ULevelEditorMiscSettings>()->bEnableEditorSounds;
}

void UEditorEngine::ClearPreviewComponents()
{
	if( PreviewAudioComponent )
	{