Declaring Delegates with Multiplayer class

Hey Everyone,

I’m trying to declare a delegate using a class that comes from the OnlineSubsystem

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSearchComplete , FOnlineSessionSearchResults, SearchResults)

UCLASS()
class BOTIBIKEYNOTEDISPLAY_API UBotIBIDisplayGameInstance : public UGameInstance
{
	GENERATED_BODY()

	UPROPERTY(BlueprintAssignable)
FOnSearchComplete OnSessionSeachComplete;

  void OnFindSessionComplete(bool bWasSuccessful)
  {
OnSessionSeachComplete.Broadcast(SessionsSearch->SearchResults);
 }

}

I keep getting the same error

FOnSearchComplete- type must be a UCLASS, USTRUCT or UENUM

If anyone has had experience with this before the help would be much appreciated.

So I figured out why it wasn’t working before (Please Correct me if I’m wrong).

“FOnlineSessionSearchResults” is not a BlueprintType, so if you try to make a delegate that will be accessed in Blueprints it will fail and give that error. To expose this class to Blueprints you have to use a wrapper struct called “FBlueprintSessionResult” which is a BlueprintType.

I don’t know if this is the only network struct that does this, I’ll update if I find any others.

Updated Code:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSearchComplete , FBlueprintSessionResult, SearchResults)
 
 UCLASS()
 class BOTIBIKEYNOTEDISPLAY_API UBotIBIDisplayGameInstance : public UGameInstance
 {
     GENERATED_BODY()
 
     UPROPERTY(BlueprintAssignable)
 FOnSearchComplete OnSessionSeachComplete;
 
   void OnFindSessionComplete(bool bWasSuccessful)
   {
      FBlueprintSessionResult searchResults = FBlueprintSessionResult();
	 searchResults.OnlineResult = SessionsSearch->SearchResults[0];
     OnSessionSeachComplete.Broadcast(searchResults );
  }

higuyssssss

higuyssssss

higuyssssss

higuyssssss

higuyssssss