cant use my delegate in BP


//UPROPERTY(BlueprintAssignable, category = "Steam Subsystem BP Callbacks")
FOnCreatePartyComplete CreatePartyComplete;

but if I tried using UPROPERTY I got

error : Unrecognized type 'FOnCreatePartyComplete' - type must be a UCLASS, USTRUCT or UENUM

You need to #include header that defines
FOnCreatePartyComplete

hmmā€¦ I thought that include ā€œOnline.hā€ will include all necessary other stuff

nothing to worksā€¦ I added #include ā€œOnlinePartyInterface.hā€ and got same error
how I can add exists delegate from this header to my custom bp class?

You could do this:

Test.h


...
#include "Test.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMyCustomOnCreatePartyComplete, ...);
//DECLARE_DELEGATE_OneParam(FMyCustomOnCreatePartyComplete, ..); <- This is causing error but I don't know why.


UCLASS()
class ATest : public AActor
{
    ...

public:
    UPROPERTY(BlueprintAssignable)
    FMyCustomOnCreatePartyComplete OnCreatePartyComplete;

    ...
}

For some reason DECLARE_DELEGATE_* is causing the error you posted:


error : Unrecognized type 'FOnCreatePartyComplete' - type must be a UCLASS, USTRUCT or UENUM

I would use my own delegate to expose to Blueprint, as you wouldnā€™t have much trouble if Unreal changes or deprecate the delegate you are trying to use. I had this problem once.
Just Broadcast your own delegate when FOnCreatePartyComplete is called.

My problem with bad known ue engine, and c++. So itā€™s not easy for me without examples :
i donā€™t know what is it means Just Broadcast your own delegate in this caseā€¦

p.s. epicsā€™ community the worst support community that I known in all this fkng world. open source without any of helpā€¦

1 Like

Delegate from OnlinePartyInterface.h


DECLARE_DELEGATE_ThreeParams(FOnCreatePartyComplete, const FUniqueNetId& /*LocalUserId*/, const TSharedPtr<const FOnlinePartyId>& /*PartyId*/, const ECreatePartyCompletionResult /*Result*/);


Custom delegates can be listed as DECLARE_DYNAMIC_MULTICAST_DELEGATE_XParam

but in this case I not sure what about diff within DECLARE_DELEGATE_XParams and DECLARE_DYNAMIC_MULTICAST_DELEGATE_XParam

I think that Iā€™ve next problem with params wich not registered in ue, such as base types: FString, bool, int32 for example.
And when I tried add the new structure Iā€™ve got error in USTRUCT section


USTRUCT(BlueprintType)
struct FStructCreatePartyComplete
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite)
        const FUniqueNetId& UniqueId;

    UPROPERTY(BlueprintReadWrite)
        const TSharedPtr<const FOnlinePartyId>& PartyID;

    UPROPERTY(BlueprintReadWrite)
        const ECreatePartyCompletionResult CompleteResult;
};

P.S. I wanna to use new structure as single param for my custom delegateā€¦

Were you able to resolve this?

...
#include "Test.generated.h"

DECLARE_DELEGATE_OneParam(FMyCustomOnCreatePartyComplete, ..);


UCLASS()
class ATest : public AActor
{
    ...

public:
    //UPROPERTY(BlueprintAssignable) <- You can't use UPROPERTY with a non-dynamic delegate
    FMyCustomOnCreatePartyComplete OnCreatePartyComplete;

    ...
}
1 Like