Skip to main content

Shutdown Server Delegate

Last updated on

The Dedicated Server will automatically shut down after a period of time when it has been claimed but contains no active players. You can also set a delegate when the auto shutdown is called using the SetOnAutoShutdownResponse(). If the auto shutdown fails, the error will be sent to SetOnAutoShutdownErrorDelegate(), as shown below.

Unreal Engine
FRegistry::ServerDSM.SetOnAutoShutdownResponse(FVoidHandler::CreateLambda([]()
{
// Do something if OnAutoShutdownResponse has been successful
}));
FRegistry::ServerDSM.SetOnAutoShutdownErrorDelegate(FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if OnAutoShutdownErrorDelegate has an error
UE_LOG(LogTemp, Log, TEXT("Error OnAutoShutdownErrorDelegate, Error Code: %d Error Message: %s"), ErrorCode, *ErrorMessage);
}));