Exposing delegate to blueprint and UHT

Traditionally you declare the delegate outside of the class. (somewhere under your .generated include and your class definition)

I’m not sure if it will not be cut off by scoping if you put it inside the class definition. All unreal docs have it at the very top.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameSession.h"
#include "NetworkHelperGameSession.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FDynamicOnStartSessionComplete, FName, name, bool, success);

/**
 *
 */
UCLASS(BlueprintType, Blueprintable)
class DGP_API ANetworkHelperGameSession : public AGameSession
{
	GENERATED_BODY()

public:
	ANetworkHelperGameSession() : AGameSession(), _enable_register_server(true) {}

	void RegisterServer() override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "NetworkHelperGameSession")
		bool _enable_register_server;

	UPROPERTY(BlueprintAssignable, Category = "NetworkHelperGameSession")
		FDynamicOnStartSessionComplete _on_start_session_complete;
}; 
1 Like