bEnableInputDeviceSubsystem

bEnableInputDeviceSubsystem

#Overview

name: bEnableInputDeviceSubsystem

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 bEnableInputDeviceSubsystem is to control the creation and availability of the Input Device Subsystem in Unreal Engine 5. This setting variable is part of the input system and determines whether the Input Device Subsystem should be enabled or disabled.

The Input Device Subsystem, which is part of the Engine module, relies on this setting variable. It is specifically used in the UInputDeviceSubsystem class, which is a subclass of UEngineSubsystem.

The value of this variable is set in the UInputSettings class, which is responsible for storing various input-related settings. By default, it is set to true in the UInputSettings constructor.

This variable interacts with the ShouldCreateSubsystem function of UInputDeviceSubsystem. When bEnableInputDeviceSubsystem is false, the Input Device Subsystem will not be created.

Developers must be aware that disabling this subsystem by setting bEnableInputDeviceSubsystem to false will prevent the creation of the Input Device Subsystem, which may affect input-related functionality in their game or application. The UInputDeviceSubsystem::Get() function may return null if this setting is disabled.

Best practices when using this variable include:

  1. Keep it enabled (true) unless there’s a specific reason to disable the Input Device Subsystem.
  2. If disabling it, ensure that your game or application doesn’t rely on any functionality provided by the Input Device Subsystem.
  3. When accessing the Input Device Subsystem through UInputDeviceSubsystem::Get(), always check for null return value, as it may be null if this setting is disabled.
  4. Consider the implications on input handling, especially for projects that use complex input setups or multiple input devices.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseInput.ini:21, section: [/Script/Engine.InputSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/InputDeviceSubsystem.h:127

Scope (from outer to inner):

file
class        class UInputDeviceSubsystem : public UEngineSubsystem, public FTickableGameObject

Source code excerpt:

	 * Returns a pointer to the Input Device Engine Subsystem if it is available.
	 * 
	 * NOTE: This may be null if the bEnableInputDeviceSubsystem flag in UInputSettings
	 * is set to false!
	 */
	static ENGINE_API UInputDeviceSubsystem* Get();

	//~ Begin UEngineSubsystem interface
	ENGINE_API virtual void Initialize(FSubsystemCollectionBase& Collection) override;
	ENGINE_API virtual void Deinitialize() override;
	ENGINE_API virtual bool ShouldCreateSubsystem(UObject* Outer) const;
	//~ End UEngineSubsystem interface
	
	//~ Begin FTickableGameObject interface	

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/InputSettings.h:85

Scope (from outer to inner):

file
class        class UInputSettings : public UObject

Source code excerpt:

	 */
	UPROPERTY(config, EditAnywhere, Category = "Input")
	uint8 bEnableInputDeviceSubsystem:1;

	/**
	 * If true, then the Player Controller will have it's Pressed Keys flushed when the input mode is changed
	 * to Game and UI mode or the game viewport loses focus. The default behavior is true.
	 * 
	 * @see UGameViewportClient::LostFocus

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/GameFramework/InputDeviceSubsystem.cpp:218

Scope (from outer to inner):

file
function     bool UInputDeviceSubsystem::ShouldCreateSubsystem

Source code excerpt:


	// There is a setting to turn off this subsystem entirely.
	const bool bShouldCreate = GetDefault<UInputSettings>()->bEnableInputDeviceSubsystem;
	if (!bShouldCreate)
	{
		UE_LOG(LogInputDeviceProperties, Log, TEXT("UInputSettings::bEnableInputDeviceSubsystem is false, the Input Device Subsystem will NOT be created!"));
	}
	
	return bShouldCreate && Super::ShouldCreateSubsystem(Outer);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UserInterface/InputSettings.cpp:27

Scope (from outer to inner):

file
function     UInputSettings::UInputSettings

Source code excerpt:

	, bEnableMotionControls(true)
	, bFilterInputByPlatformUser(false)
	, bEnableInputDeviceSubsystem(true)
	, bShouldFlushPressedKeysOnViewportFocusLost(true)
	, bEnableDynamicComponentInputBinding(true)
	, DefaultViewportMouseCaptureMode(EMouseCaptureMode::CapturePermanently_IncludingInitialMouseDown)
	, DefaultViewportMouseLockMode(EMouseLockMode::LockOnCapture)
	, DefaultPlayerInputClass(UPlayerInput::StaticClass())
	, DefaultInputComponentClass(UInputComponent::StaticClass())