Hi,
Here’s the thing, every time I bind a function with OnSeePawn.AddDynamic() I will get a bunch of callstack errors but after that, it will work fine and the binding also works as the pawn will actually run the code in that function when it sees the player.
Here’s the binding:
if (SensingComponent)
{
SensingComponent->OnSeePawn.AddDynamic(this, &ANonPlayableCharacter::PawnSeen);
}
Here’s the .h file where the function is. It’s protected and virtual as I override it on a class that inherits from this one:
UFUNCTION()
virtual void PawnSeen(APawn* SeenPawn);
The NPC class does not do anything in the function but the Enemy does:
.h file
virtual void PawnSeen(APawn* SeenPawn) override;
.cpp
void AEnemy::PawnSeen(APawn* SeenPawn)
{
Super::PawnSeen(SeenPawn);
NPCBlackboard->SetValueAsBool(TEXT("EnemySeen"), true);
NPCBlackboard->SetValueAsObject(TEXT("TargetEnemy"), SeenPawn);
}
That’s it. Again, it works but gives me these errors when I hit play in the editor:
FallenGods is the project and line 38 in NonPlayableCharacter.cpp is where I bind the delegate to the function.
LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: InvocationList[ CurFunctionIndex ] != InDelegate [File:H:\Program Files (x86)\UE\UE_5.1\Engine\Source\Runtime\Core\Public\UObject\ScriptDelegates.h] [Line: 561]
LogOutputDevice: Error: Stack:
LogOutputDevice: Error: [Callstack] 0x00007ffa7c830e2c UnrealEditor-FallenGods-0032.dll!TMulticastScriptDelegate<FWeakObjectPtr>::AddInternal() [H:\Program Files (x86)\UE\UE_5.1\Engine\Source\Runtime\Core\Public\UObject\ScriptDelegates.h:561]
LogOutputDevice: Error: [Callstack] 0x00007ffa7c830b43 UnrealEditor-FallenGods-0032.dll!TBaseDynamicMulticastDelegate<FWeakObjectPtr,void,APawn *>::__Internal_AddDynamic<ANonPlayableCharacter>() [H:\Program Files (x86)\UE\UE_5.1\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:1130]
LogOutputDevice: Error: [Callstack] 0x00007ffa7c831307 UnrealEditor-FallenGods-0032.dll!ANonPlayableCharacter::SetupComponents() [H:\Program Files (x86)\UE\UE Projects\FallenGods\Source\FallenGods\Private\Characters\NonPlayableCharacter.cpp:38]
LogOutputDevice: Error: [Callstack] 0x00007ffa80073793 UnrealEditor-Engine.dll!AActor::DispatchBeginPlay() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\Actor.cpp:4055]
LogOutputDevice: Error: [Callstack] 0x00007ffa81e8c886 UnrealEditor-Engine.dll!AWorldSettings::NotifyBeginPlay() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\WorldSettings.cpp:291]
LogOutputDevice: Error: [Callstack] 0x00007ffa80ae79c1 UnrealEditor-Engine.dll!AGameStateBase::HandleBeginPlay() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\GameStateBase.cpp:207]
LogOutputDevice: Error: [Callstack] 0x00007ffa81d69660 UnrealEditor-Engine.dll!UWorld::BeginPlay() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\World.cpp:4882]
LogOutputDevice: Error: [Callstack] 0x00007ffa80b05225 UnrealEditor-Engine.dll!UGameInstance::StartPlayInEditorGameInstance() [D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\GameInstance.cpp:547]
LogOutputDevice: Error: [Callstack] 0x00007ffa78de6395 UnrealEditor-UnrealEd.dll!UEditorEngine::CreateInnerProcessPIEGameInstance() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:3163]
LogOutputDevice: Error: [Callstack] 0x00007ffa78e0d279 UnrealEditor-UnrealEd.dll!UEditorEngine::OnLoginPIEComplete_Deferred() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1626]
LogOutputDevice: Error: [Callstack] 0x00007ffa78de6feb UnrealEditor-UnrealEd.dll!UEditorEngine::CreateNewPlayInEditorInstance() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1889]
LogOutputDevice: Error: [Callstack] 0x00007ffa78e2723a UnrealEditor-UnrealEd.dll!UEditorEngine::StartPlayInEditorSession() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:2894]
LogOutputDevice: Error: [Callstack] 0x00007ffa78e2ae57 UnrealEditor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequestImpl() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1203]
LogOutputDevice: Error: [Callstack] 0x00007ffa78e2a621 UnrealEditor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequest() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\PlayLevel.cpp:1106]
LogOutputDevice: Error: [Callstack] 0x00007ffa7879b1f5 UnrealEditor-UnrealEd.dll!UEditorEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\EditorEngine.cpp:1777]
LogOutputDevice: Error: [Callstack] 0x00007ffa7921d1b6 UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick() [D:\build\++UE5\Sync\Engine\Source\Editor\UnrealEd\Private\UnrealEdEngine.cpp:517]
LogOutputDevice: Error: [Callstack] 0x00007ff6e5ce852c UnrealEditor.exe!FEngineLoop::Tick() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5367]
LogOutputDevice: Error: [Callstack] 0x00007ff6e5d0287d UnrealEditor.exe!GuardedMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:202]
LogOutputDevice: Error: [Callstack] 0x00007ff6e5d0296a UnrealEditor.exe!GuardedMainWrapper() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:107]
LogOutputDevice: Error: [Callstack] 0x00007ff6e5d05680 UnrealEditor.exe!LaunchWindowsStartup() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:244]
LogOutputDevice: Error: [Callstack] 0x00007ff6e5d171b4 UnrealEditor.exe!WinMain() [D:\build\++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:282]
LogOutputDevice: Error: [Callstack] 0x00007ff6e5d1a516 UnrealEditor.exe!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
LogOutputDevice: Error: [Callstack] 0x00007ffab9c17614 KERNEL32.DLL!UnknownFunction []
LogOutputDevice: Error: [Callstack] 0x00007ffab9f426a1 ntdll.dll!UnknownFunction []
Any idea?
Thank you!