Binding to the ReceiveMoveCompleted event breaks cooking

Binding to the AIController’s ReceiveMoveCompleted event in blueprints returns an AIRequestID structure which is not blueprint compatible. Trying to cook the build will fail with the following error.

UATHelper: Packaging (Windows (64-bit)): UnrealBuildTool: C:/GV/Intermediate/Plugins/WindowsNoEditor/NativizedAssets/Source/NativizedAssets/Public/AI_Task_MoveToActor__pf3605976607.h(60) : LogCompile: Error: Type 'FAIRequestID' is not supported by blueprint. bpf__cb_ReceiveMoveCompleted__pf.bpp__RequestID__pf

As a workaround, in C++ you can fire a replacement delegate in a child class for AIController, but obviously that won’t help for blueprint-only projects.

(See code below for details!)

Any chance you could explain this more in depth please? I’m getting the same answer and don’t understand how to implement your workaround.

Sure thing - here’s the code from my project for a new child class of AAIController:

#pragma once

#include "CoreMinimal.h"
#include "AIController.h"
#include "GV_CPP_AIController.generated.h"


DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FGV_AIC_MoveCompleted, EPathFollowingResult::Type, Result);

/**
 * 
 */
UCLASS()
class GONEVIRAL_API AGV_CPP_AIController : public AAIController
{
	GENERATED_BODY()


	UPROPERTY(BlueprintAssignable, BlueprintCallable)
		FGV_AIC_MoveCompleted Callback_AIController_MoveCompleted;

	// Overriding base 
	void OnMoveCompleted(FAIRequestID RequestID, const FPathFollowingResult& Result) { Super::OnMoveCompleted(RequestID, Result);  Callback_AIController_MoveCompleted.Broadcast(Result.Code); };
};

All we’re doing there is extending the function OnMoveCompleted, and throwing a new delegate we’ve made called Callback_AIController_MoveCompleted.

We can use that new delegate no problem in blueprints, because it is marked as BlueprintAssignable and BlueprintCallable and avoids passing along the FAIRequestID - which fixes the issue when building.

I’ll make my original answer more clear if it’ll still let me edit it :slight_smile:

In our project we’re essentially using only blueprints (minus a few custom procedural things done in C++). In order to do this for our BP_AIC, is there any way to create a child of a blueprint as C++?
I know that’s a longshot but figured I’d ask.

Thanks for such a quick response! Glorious!

No problem!

Unfortunately I don’t think there’s a blueprint only workaround, because the issue at heart is that the engine is using a type in its delegate that blueprints don’t understand (FAI_RequestID) and when nativizing that issue is causing the error you see.

The deep bug here is that apparently UE is OK with that non-blueprint struct appearing in blueprints via a function signature in the editor but not in natvizing/packaging.

Without fixing that probably-tricky bug, the easy engine fix would be to make that struct blueprintable (basically adding a single keyword to the declaration of the struct) but you’d need to be patching in that one-word, presumably trivial, engine fix for that.

If you know someone friendly who submits engine bugfixes they could well help with that bit.

One other thought - if you set your particular blueprint that references this to not be nativized does that avoid this?

Oh, and to answer your question when I read more closely - you can’t have a C++ class parented to a blueprint class. But you can make a very similar class to the one I made (basically replacing GONEVIRAL_API with your project API, and naming it without the GV we use for classes) in C++ and then reparent your existing AI controller-child blueprint (BP_AIC) to that new class.