End simulation during "Use Claimed Gameplay Behavior Smart Object" Node crashes editor

I have followed the Smart Objects Quick Start tutorial and for the most part it works. However if I exit the simulation after the “Use Claimed Gameplay Behavior Smart Object” node is called and before it completes the editor crashes. If I end the simulation at any other time there is no issue, it’s specifically while the Use Claimed Gameplay Behavior Smart Object node is navigating my AI Actor to a Smart Object.

When the crash occurs the top of the stack trace is:

Assertion failed: OwnerController->GetPawn() [File:D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayBehaviorSmartObjects\Source\GameplayBehaviorSmartObjectsModule\Private\AI\AITask_UseGameplayBehaviorSmartObject.cpp] [Line: 271]

That line in question is calling a check() function on OwnerController->GetPawn(). I’m assuming the check() function is just an assertion that the input is not null - can anyone tell me whether that assumption is correct?

If so, what then? The controller input to that node is the Owner Controller passed in by the Event Receive Execute AI. I’m not sure there should necessarily be an expectation that the owner controller has a Pawn?

My guess is that there’s something amiss in the configuration of the AI Controller, and I assume that gets configured under the hood by the various Blueprint Classes etc I created during the tutorial. If anyone has any insight into exactly what the GetPawn() is supposed to be referring to and how that relates to my resources I’d appreciate the help.

1 Like

Hey,
I had exacly the same error. The problem is the callback “OnSlotInvalidated”
seems that if it gets called on game destruction the pawn doesn’t exist anymore.

void UAITask_UseGameplayBehaviorSmartObject::OnSlotInvalidated(const FSmartObjectClaimHandle& ClaimHandle, ESmartObjectSlotState State)
{
    // these two lines do the trick. Maybe there is a smarter way ;)
	if(OwnerController == nullptr) return;
	if(OwnerController->GetPawn() == nullptr) return;
	
	Abort();

	EndTask();
}

Hey did you ever figure out a fix for this issue? We’re running into it but haven’t found a fix yet…

Hi, I just had the same issue when I switched unreal version from 5.1 to 5.2. What helped was Reloading all AI-related assets. After that I had to fix some cached things and it started working again.

Hey ! i’m have the same issue, if its possible could u be a bit more detailed on how did u fixed it

1 Like

I’m also having the same issue. If someone could list the steps required to fix this it would be super helpful. :slightly_smiling_face:

1 Like
  1. Go to Epic Games\UE_5.2\Engine\Plugins\Runtime and move the “GameplayBehaviorSmartObjects” to your Plugins project folder.

  2. If you don’t have the Plugins folder, create one in the project root folder.

  3. Go to GameplayBehaviorSmartObjectsModule\Private\AI\AITask_UseGameplayBehaviorSmartObject.cpp - UAITask_UseGameplayBehaviorSmartObject::Abort, comment out check(OwnerController->GetPawn()); and add if (OwnerController->GetPawn()) check before the AbortBehavior.

  4. Do the same in UAITask_UseGameplayBehaviorSmartObject::OnGameplayTaskDeactivated and add a nullptr check on line 204

In case the problem still persists, check your Build.cs and remove “GameplayBehaviorSmartObjectsModule” from the PublicDependencyModuleNames.

With these changes your project should use the custom plugin from the project Plugins folder and the plugin will no longer crash the editor on game stop. However, in case of the plugin updates you have to update it manually until they fix the issue.

4 Likes

thank you for taking the time to answer!

Still having a issue my side can you please explain what i need to do when you say check your build.cs step

It is probably still taking the plugin from the engine folder. Make sure it uses the one in your project. You can even try deleting it from the engine folder to be sure. The error should not happen then. Build.cs could stay as it is.

Just ran into this problem as well. Verified that the plugin is in fact listed in the “PROJECT” node of the plugin list within the editor. Error happens on the same line number, a line that is commented out. So clearly its not using my plugin and using a cache maybe?

Hmmm, I was using a BluePrint project. Make sure you go to “Tools” - “New C++ Class” and create a new dummy file. This will enable C++ for your project. Restart, then it will work and your local plugin will be used.

1 Like

Thanks for noting this. I didn’t test it on a pure blueprint project so that was probably the reason my solution didn’t work also for Panos98.

I think mine may also be related to this? It only seems to happen when they are in a World Partition Level though.

Assertion failed: SmartObjectSubsystem [File:D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayInteractions\Source\GameplayInteractionsModule\Private\GameplayInteractionContext.cpp] [Line: 121]

UnrealEditor_GameplayInteractionsModule!FGameplayInteractionContext::Deactivate() [D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayInteractions\Source\GameplayInteractionsModule\Private\GameplayInteractionContext.cpp:121]
UnrealEditor_GameplayInteractionsModule!UAITask_UseGameplayInteraction::OnDestroy() [D:\build++UE5\Sync\Engine\Plugins\Runtime\GameplayInteractions\Source\GameplayInteractionsModule\Private\AI\AITask_UseGameplayInteraction.cpp:195]
UnrealEditor_GameplayInteractionsModule!V::TBaseUObjectMethodDelegateInstance::ExecuteIfSafe() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:667]
UnrealEditor_SmartObjectsModule!FSmartObjectRuntimeSlot::Release() [D:\build++UE5\Sync\Engine\Plugins\Runtime\SmartObjects\Source\SmartObjectsModule\Private\SmartObjectRuntime.cpp:169]
UnrealEditor_SmartObjectsModule!USmartObjectSubsystem::AbortAll() [D:\build++UE5\Sync\Engine\Plugins\Runtime\SmartObjects\Source\SmartObjectsModule\Private\SmartObjectSubsystem.cpp:640]