UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
InputDeviceSubsystem.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "InputSettings.h"
8#include "Tickable.h"
10#include "InputDeviceSubsystem.generated.h"
11
13
15
17USTRUCT(BlueprintType)
19{
21
23
25 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Activation Options")
27
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Activation Options")
36
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Activation Options")
42 uint8 bLooping : 1;
43
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Activation Options")
46 uint8 bIgnoreTimeDilation : 1;
47
49 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Activation Options")
50 uint8 bPlayWhilePaused : 1;
51};
52
54USTRUCT()
56{
58
60
62 ENGINE_API friend uint32 GetTypeHash(const FActiveDeviceProperty& InProp);
65
66 ENGINE_API bool operator==(const FActiveDeviceProperty& Other) const;
68
70 UPROPERTY()
72
74 double EvaluatedDuration;
75
77 FPlatformUserId PlatformUser;
78
81
84
89 uint8 bLooping : 1;
90
92 uint8 bIgnoreTimeDilation : 1;
93
95 uint8 bPlayWhilePaused : 1;
96
104 uint8 bHasBeenAppliedAtLeastOnce : 1;
105};
106
113
118UCLASS(BlueprintType, MinimalAPI)
120{
122 friend class FInputDeviceDebugTools;
123
125public:
126
131
132 //~ Begin UEngineSubsystem interface
134 ENGINE_API virtual void Deinitialize() override;
135 ENGINE_API virtual bool ShouldCreateSubsystem(UObject* Outer) const override;
136 //~ End UEngineSubsystem interface
137
138 //~ Begin FTickableGameObject interface
139 ENGINE_API virtual UWorld* GetTickableGameObjectWorld() const override;
140 ENGINE_API virtual ETickableTickType GetTickableTickType() const override;
141 ENGINE_API virtual bool IsTickable() const override;
142 ENGINE_API virtual bool IsTickableInEditor() const override;
143 ENGINE_API virtual TStatId GetStatId() const override;
145 //~ End FTickableGameObject interface
146
154
156 UFUNCTION(BlueprintCallable, Category = "Input Devices", meta = (AutoCreateRefTerm = "Params", ReturnDisplayName = "Device Property Handle"))
157 ENGINE_API FInputDevicePropertyHandle ActivateDevicePropertyOfClass(TSubclassOf<UInputDeviceProperty> PropertyClass, const FActivateDevicePropertyParams& Params);
158
160 UFUNCTION(BlueprintCallable, Category = "Input Devices", meta=(ReturnDisplayName="Device Property"))
161 ENGINE_API UInputDeviceProperty* GetActiveDeviceProperty(const FInputDevicePropertyHandle Handle) const;
162
164 UFUNCTION(BlueprintCallable, Category = "Input Devices", meta = (ReturnDisplayName = "Is Active"))
165 ENGINE_API bool IsPropertyActive(const FInputDevicePropertyHandle Handle) const;
166
174 UFUNCTION(BlueprintCallable, Category = "Input Devices")
175 ENGINE_API void RemoveDevicePropertyByHandle(const FInputDevicePropertyHandle HandleToRemove);
176
184 UFUNCTION(BlueprintCallable, Category = "Input Devices")
185 ENGINE_API void RemoveDevicePropertyHandles(const TSet<FInputDevicePropertyHandle>& HandlesToRemove);
186
188 UFUNCTION(BlueprintCallable, Category = "Input Devices")
189 ENGINE_API void RemoveAllDeviceProperties();
190
192 UFUNCTION(BlueprintCallable, Category = "Input Devices")
193 ENGINE_API FHardwareDeviceIdentifier GetMostRecentlyUsedHardwareDevice(const FPlatformUserId InUserId) const;
194
203 UFUNCTION(BlueprintCallable, Category = "Input Devices", meta = (ReturnDisplayName = "Latest Device Id"))
205
206 UFUNCTION(BlueprintCallable, Category = "Input Devices")
207 ENGINE_API FHardwareDeviceIdentifier GetInputDeviceHardwareIdentifier(const FInputDeviceId InputDevice) const;
208
212 ENGINE_API FInputDeviceId GetLatestDeviceOfType(const FPlatformUserId InUserId, const EHardwareDevicePrimaryType OfType) const;
213
215 UPROPERTY(BlueprintAssignable, Category = "Input Devices")
216 FHardwareInputDeviceChanged OnInputHardwareDeviceChanged;
217
219
221 ENGINE_API void SetMostRecentlyUsedHardwareDevice(const FInputDeviceId InDeviceId, const FHardwareDeviceIdentifier& InHardwareId);
222
223 // Callbacks for when PIE is started/stopped. We will likely want to pause/resume input device properties
224 // when this happens, or just remove all active properties when PIE stops. This will make designer iteration a little easier
225#if WITH_EDITOR
226 ENGINE_API void OnPrePIEStarted(bool bSimulating);
227 ENGINE_API void OnPIEPaused(bool bSimulating);
228 ENGINE_API void OnPIEResumed(bool bSimulating);
229 ENGINE_API void OnPIEStopped(bool bSimulating);
230
231 bool bIsPIEPlaying = false;
232
233#endif // WITH_EDITOR
234
235#if WITH_EDITORONLY_DATA
236
237 struct FResetPIEData
238 {
240 FInputDeviceId DeviceId;
241 FPlatformUserId UserId;
242 };
243
249
250#endif // WITH_EDITORONLY_DATA
251
256 TSet<FActiveDeviceProperty> ActiveProperties;
257
263 TSet<FInputDevicePropertyHandle> PropertiesPendingRemoval;
264
268 TMap<FInputDeviceId, FHardwareDeviceIdentifier> LatestInputDeviceIdentifiers;
269
286
289
292};
constexpr FInputDeviceId INPUTDEVICEID_NONE
Definition CoreMiscDefines.h:590
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name)
Definition DelegateCombinations.h:62
EHardwareDevicePrimaryType
Definition InputSettings.h:408
UE_FORCEINLINE_HINT bool operator!=(const FIndexedPointer &Other) const
Definition LockFreeList.h:76
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
ETickableTickType
Definition Tickable.h:20
@ Unspecified
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition InputDeviceSubsystem.cpp:24
Definition SubsystemCollection.h:15
Definition Tickable.h:135
Definition InputDevice.Build.cs:6
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition SubclassOf.h:30
Definition EngineSubsystem.h:22
Definition InputDeviceProperties.h:33
Definition InputDeviceSubsystem.h:120
TMap< FPlatformUserId, FLatestInputDeviceData > LatestUserDeviceIdentifiers
Definition InputDeviceSubsystem.h:288
TSharedPtr< class FInputDeviceSubsystemProcessor > InputPreprocessor
Definition InputDeviceSubsystem.h:291
Definition Object.h:95
Definition World.h:918
Definition InputDeviceSubsystem.h:19
Definition InputDeviceSubsystem.h:56
Definition InputSettings.h:432
Definition CoreMiscDefines.h:524
Definition InputDevicePropertyHandle.h:10
Definition CoreMiscDefines.h:470
Definition ObjectPtr.h:488
Definition LightweightStats.h:416
Definition WeakObjectPtrTemplates.h:25
Definition InputDeviceSubsystem.h:274
TMap< EHardwareDevicePrimaryType, FInputDeviceId > LatestDevices
Definition InputDeviceSubsystem.h:284