bAllowMatureLanguage

bAllowMatureLanguage

#Overview

name: bAllowMatureLanguage

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 bAllowMatureLanguage is to control whether mature language content is allowed in the game’s audio system. This setting variable is used to determine if sound nodes marked as mature should be played or not.

The bAllowMatureLanguage variable is primarily used by the Unreal Engine’s audio system, specifically within the sound node system. It is referenced in the Engine module and is utilized by the USoundNodeMature class.

The value of this variable is set in the engine configuration files. It is defined as a config property in the UEngine class, which means it can be modified through the project settings or configuration files.

This variable interacts closely with the USoundNodeMature class and USoundWave assets. The USoundNodeMature class uses this setting to determine which child nodes to play, preferring mature nodes when bAllowMatureLanguage is true. Additionally, USoundWave assets have a ‘bMature’ flag that is checked against this setting.

Developers must be aware that this variable affects the content of audio played in the game. When set to false, it will prevent the playback of sound waves marked as mature. This can be useful for creating different versions of the game with varying levels of mature content or for implementing parental controls.

Best practices when using this variable include:

  1. Clearly marking mature audio content by setting the ‘bMature’ flag on appropriate USoundWave assets.
  2. Using USoundNodeMature nodes in sound cues to create alternative, non-mature audio paths.
  3. Considering the target audience and potential rating requirements when deciding the default value for this setting.
  4. Providing an in-game option for users to toggle this setting if appropriate for the game’s design.
  5. Testing the audio system thoroughly with both true and false values to ensure proper behavior in all scenarios.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:137, section: [/Script/Engine.Engine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:1631

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** Whether to play mature language sound nodes */
	UPROPERTY(config)
	uint32 bAllowMatureLanguage:1;

	/** camera rotation (deg) beyond which occlusion queries are ignored from previous frame (because they are likely not valid) */
	UPROPERTY(config)
	float CameraRotationThreshold;

	/** camera movement beyond which occlusion queries are ignored from previous frame (because they are likely not valid) */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Sound/SoundNodeMature.h:14

Scope: file

Source code excerpt:


/**
 * This SoundNode uses UEngine::bAllowMatureLanguage to determine whether child nodes
 * that have USoundWave::bMature=true should be played. 
 */
UCLASS(hidecategories=Object, editinlinenew, MinimalAPI, meta=( DisplayName="Mature" ))
class USoundNodeMature : public USoundNode
{
	GENERATED_UCLASS_BODY()


public:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeMature.cpp:110

Scope (from outer to inner):

file
function     void USoundNodeMature::ParseNodes

Source code excerpt:

		// Select a child node.
		NodeIndex = -1;
		if( GEngine->bAllowMatureLanguage )
		{
			// If mature language is allowed, prefer a mature node.
			if( MatureChildNodes.Num() > 0 )
			{
				NodeIndex = MatureChildNodes[ 0 ];
			}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SoundNodeMature.cpp:160

Scope (from outer to inner):

file
function     void USoundNodeMature::PostLoad

Source code excerpt:

		{
			USoundNodeWavePlayer *WavePlayer = Cast<USoundNodeWavePlayer>(ChildNodes[i]);
			if (WavePlayer && WavePlayer->GetSoundWave() && WavePlayer->GetSoundWave()->bMature != GEngine->bAllowMatureLanguage)
			{
				ChildNodes.RemoveAt(i);
			}
		}
	}
}