USTRUCT not detected for UPROPERTY

Hi, I want to use FKey struct to do some tutorial display for my game. Here is the class and struct I declare for doing so:

#include "Engine/DataAsset.h"
#include "InputCoreTypes.h"

#include "LSDataAssetLibrary.generated.h"

USTRUCT(BlueprintType)
struct FUnderAxis
{
	GENERATED_BODY()
	
	UPROPERTY(EditDefaultsOnly)
	TArray<FKey> Axis;
};

UCLASS(BlueprintType)
class UAxisMapping : public UDataAsset
{
	GENERATED_BODY()
public:
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	TMap<FKey, FUnderAxis> UnderAxisMapping;

	UFUNCTION(BlueprintCallable)
	FKey GetUpperAxis(FKey Key);
};

UCLASS(BlueprintType)
class UImageKeyMapping : public UDataAsset
{
	GENERATED_BODY()
public:
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	TMap<FKey, UTexture2D*> KeyMapping;

	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	TSoftObjectPtr<UAxisMapping> AxisMapping;

	UFUNCTION(BlueprintCallable)
	UTexture2D* GetTextureFromKey(FKey Key, FKey& OutKey);
};

I also have a multicast dynamic delegate declared like so:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnInputDownSignature, FKey, KeyPressed);

I’m using Rider, and I have an error message for every occurence of “FKey” declaration which is Unable to find 'class', 'delegate', 'enum', or 'struct' with name 'FKey' [UnrealHeaderTool Error]

However, the FKey struct is declared as it follows

USTRUCT(BlueprintType,Blueprintable)
struct INPUTCORE_API FKey
{
	GENERATED_USTRUCT_BODY()

	FKey()
	{
	}

	FKey(const FName InName)
		: KeyName(InName)
	{
	}

	FKey(const TCHAR* InName)
		: KeyName(FName(InName))
	{
	}

	FKey(const ANSICHAR* InName)
		: KeyName(FName(InName))
	{
	}

	bool IsValid() const;
	bool IsModifierKey() const;
	bool IsGamepadKey() const;
	bool IsTouch() const;
	bool IsMouseButton() const;
	bool IsButtonAxis() const;
	bool IsAxis1D() const;
	bool IsAxis2D() const;
	bool IsAxis3D() const;
	UE_DEPRECATED(4.26, "Please use IsAxis1D instead.")
	bool IsFloatAxis() const;
	UE_DEPRECATED(4.26, "Please use IsAxis2D/IsAxis3D instead.")
	bool IsVectorAxis() const;
	bool IsDigital() const;
	bool IsAnalog() const;
	bool IsBindableInBlueprints() const;
	bool ShouldUpdateAxisWithoutSamples() const;
	bool IsBindableToActions() const;
	bool IsDeprecated() const;
	bool IsGesture() const;
	FText GetDisplayName(bool bLongDisplayName = true) const;
	FString ToString() const;
	FName GetFName() const;
	FName GetMenuCategory() const;
	EPairedAxis GetPairedAxis() const;
	FKey GetPairedAxisKey() const;

	bool SerializeFromMismatchedTag(struct FPropertyTag const& Tag, FStructuredArchive::FSlot Slot);
	bool ExportTextItem(FString& ValueStr, FKey const& DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const;
	bool ImportTextItem(const TCHAR*& Buffer, int32 PortFlags, UObject* Parent, FOutputDevice* ErrorText);
	void PostSerialize(const FArchive& Ar);
	void PostScriptConstruct();

	friend bool operator==(const FKey& KeyA, const FKey& KeyB) { return KeyA.KeyName == KeyB.KeyName; }
	friend bool operator!=(const FKey& KeyA, const FKey& KeyB) { return KeyA.KeyName != KeyB.KeyName; }
	friend bool operator<(const FKey& KeyA, const FKey& KeyB) { return KeyA.KeyName.LexicalLess(KeyB.KeyName); }
	friend uint32 GetTypeHash(const FKey& Key) { return GetTypeHash(Key.KeyName); }

	friend struct EKeys;

	static const TCHAR* SyntheticCharPrefix;

private:

	UPROPERTY()
	FName KeyName;

	mutable class TSharedPtr<struct FKeyDetails> KeyDetails;

	void ConditionalLookupKeyDetails() const;
	void ResetKey();
};

And it’s a struct created inside Unreal.

My problem is that the error doesn’t prevent me to build the project, to run in editor mode, and the tutorial to be as I want. However, since I play this in standalone, I got an exception access violation:

LoginId:e81b912842dc77a490e7d58111b38c53
EpicAccountId:aa3b89b4ac0b4c35b2e1e459e161f6a1

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000060

UnrealEditor_Yadic!UAxisMapping::GetUpperAxis() [C:\Users\Alexis Mathoux\Documents\Projects\LS\Yadic\Source\Yadic\Private\Library\LSDataAssetLibrary.cpp:28]
UnrealEditor_Yadic!UImageKeyMapping::GetTextureFromKey() [C:\Users\Alexis Mathoux\Documents\Projects\LS\Yadic\Source\Yadic\Private\Library\LSDataAssetLibrary.cpp:14]
UnrealEditor_Yadic!UImageKeyMapping::execGetTextureFromKey() [C:\Users\Alexis Mathoux\Documents\Projects\LS\Yadic\Intermediate\Build\Win64\UnrealEditor\Inc\Yadic\UHT\LSDataAssetLibrary.gen.cpp:234]
UnrealEditor_CoreUObject!UFunction::Invoke() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6411]
UnrealEditor_CoreUObject!UObject::CallFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1133]
UnrealEditor_CoreUObject!UObject::ProcessContextOpcode() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:3075]
UnrealEditor_CoreUObject!UObject::execLetObj() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:2865]
UnrealEditor_CoreUObject!ProcessLocalScriptFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1203]
UnrealEditor_CoreUObject!ProcessScriptFunction<void (__cdecl*)(UObject *,FFrame &,void *)>() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1033]
UnrealEditor_CoreUObject!ProcessLocalFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1273]
UnrealEditor_CoreUObject!ProcessLocalScriptFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1203]
UnrealEditor_CoreUObject!UObject::ProcessInternal() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1300]
UnrealEditor_CoreUObject!UFunction::Invoke() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6411]
UnrealEditor_CoreUObject!UObject::ProcessEvent() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:2131]
UnrealEditor_Yadic!TMulticastScriptDelegate<FWeakObjectPtr>::ProcessMulticastDelegate<UObject>() [C:\Program Files\Epic Games\UE_5.2\Engine\Source\Runtime\Core\Public\UObject\ScriptDelegates.h:565]
UnrealEditor_Yadic!FOnInputDownSignature_DelegateWrapper() [C:\Users\Alexis Mathoux\Documents\Projects\LS\Yadic\Intermediate\Build\Win64\UnrealEditor\Inc\Yadic\UHT\ALSPlayerController.gen.cpp:70]
UnrealEditor_Yadic!AALSPlayerController::OnInputDown() [C:\Users\Alexis Mathoux\Documents\Projects\LS\Yadic\Source\Yadic\Private\ALS\Character\ALSPlayerController.cpp:301]
UnrealEditor_Yadic!AALSPlayerController::execOnInputDown() [C:\Users\Alexis Mathoux\Documents\Projects\LS\Yadic\Intermediate\Build\Win64\UnrealEditor\Inc\Yadic\UHT\ALSPlayerController.gen.cpp:315]
UnrealEditor_CoreUObject!UFunction::Invoke() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6411]
UnrealEditor_CoreUObject!UObject::CallFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1133]
UnrealEditor_CoreUObject!ProcessLocalScriptFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1203]
UnrealEditor_CoreUObject!ProcessScriptFunction<void (__cdecl*)(UObject *,FFrame &,void *)>() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1033]
UnrealEditor_CoreUObject!ProcessLocalFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1273]
UnrealEditor_CoreUObject!ProcessLocalScriptFunction() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1203]
UnrealEditor_CoreUObject!UObject::ProcessInternal() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1300]
UnrealEditor_CoreUObject!UFunction::Invoke() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:6411]
UnrealEditor_CoreUObject!UObject::ProcessEvent() [D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:2131]
UnrealEditor_Engine!AActor::ProcessEvent() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:1055]
UnrealEditor_Engine!FInputActionHandlerDynamicSignature_DelegateWrapper() [D:\build\++UE5\Sync\Engine\Intermediate\Build\Win64\UnrealEditor\Inc\Engine\UHT\InputComponent.gen.cpp:71]
UnrealEditor_Engine!FInputActionUnifiedDelegate::Execute() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Classes\Components\InputComponent.h:302]
UnrealEditor_Engine!UPlayerInput::ProcessInputStack() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\UserInterface\PlayerInput.cpp:1431]
UnrealEditor_EnhancedInput!UEnhancedPlayerInput::ProcessInputStack() [D:\build\++UE5\Sync\Engine\Plugins\EnhancedInput\Source\EnhancedInput\Private\EnhancedPlayerInput.cpp:276]
UnrealEditor_Engine!APlayerController::ProcessPlayerInput() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:2704]
UnrealEditor_Engine!APlayerController::TickPlayerInput() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:4985]
UnrealEditor_Engine!APlayerController::PlayerTick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:2308]
UnrealEditor_Engine!APlayerController::TickActor() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\PlayerController.cpp:5137]
UnrealEditor_Engine!FActorTickFunction::ExecuteTick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:212]
UnrealEditor_Engine!FTickFunctionTask::DoTask() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:275]
UnrealEditor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:1310]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:758]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:649]
UnrealEditor_Core!FTaskGraphCompatibilityImplementation::WaitUntilTasksComplete() [D:\build\++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:2123]
UnrealEditor_Engine!FTickTaskSequencer::ReleaseTickGroup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:556]
UnrealEditor_Engine!FTickTaskManager::RunTickGroup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:1583]
UnrealEditor_Engine!UWorld::RunTickGroup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:770]
UnrealEditor_Engine!UWorld::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1512]
UnrealEditor_Engine!UGameEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1771]
UnrealEditor!FEngineLoop::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5812]
UnrealEditor!GuardedMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:188]
UnrealEditor!GuardedMainWrapper() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:107]
UnrealEditor!LaunchWindowsStartup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:244]
UnrealEditor!WinMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:284]
UnrealEditor!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Every topics I see talk about “You can’t declare a type which is not a USTRUCT or a UPROPERTY as a UPROPERTY”, which I agree 10000%, but this is not working even if FKey is a USTRUCT, and this is going to make me crazy…

this might be a Rider problem (JetBrain proclaims it to be “smart enough”)
what is happening before and during LSDataAssetLibrary.cpp:14(UImageKeyMapping::GetUpperAxis()) and LSDataAssetLibrary.cpp:28 (UAxisMapping::GetUpperAxis())

in most cases EXCEPTION_ACCESS_VIOLATION typically means you are trying to do something with a pointer that hasn’t been initialized yet, so try doing log statements around the Line 14 inside the LSDataAssetLibrary.cpp::GetUpperAxis()

There are a few possibly unrelated things going on here.
The warnings you see in Rider don’t have to be a real cause for problems, if the code compiles it will work.

The one problem I see is during UAxisMapping::GetUpperAxis() in LSDataAssetLibrary.cpp on line 28. It seems you are attempting to read a nullptr assuming it is not null. Do a check if it the relevant property is null and if that should not happen log until you find the cause. Easiest way is to use breakpoints and the debugger.

Okay, I was just stupid about this. The problem is gone by doing one thing:

Changing TSoftObjectPtr to TObjectPtr. Because the Axis mapping data asset was not loaded because I didn’t say anywhere to load async this data asset.

I still have the error but this is clearly from Rider, because it compiles correctly.

Thanks for your answers

I would suggest giving Visual Studio (even the free Community version) a go. they are making great strides on Unreal Engine integration in just the last couple months.
I have some gripes with it, but really it looks like Visual Studio might have a better understanding of the C++ itself. (FKey is included in CoreMinimal…)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.