Skip to content

Instantly share code, notes, and snippets.

@JElbourne
Created June 28, 2021 23:32
Show Gist options
  • Save JElbourne/b6c894c1457c10ccae9dfa14acea2a07 to your computer and use it in GitHub Desktop.
Save JElbourne/b6c894c1457c10ccae9dfa14acea2a07 to your computer and use it in GitHub Desktop.
YourGameInstance.h - For Video: https://youtu.be/jc0COamYRm4
#pragma once
#include "CoreMinimal.h"
#include "OnlineSubsystem.h"
#include "OnlineSessionSettings.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "Engine/GameInstance.h"
#include "CreteGameInstance.generated.h"
/**
*
*/
UCLASS()
class MULTIPLAYERTEST_API UCreteGameInstance : public UGameInstance
{
GENERATED_BODY()
public:
UCreteGameInstance();
protected:
TSharedPtr<FOnlineSessionSearch> SessionSearch;
IOnlineSessionPtr SessionInterface;
virtual void Init() override;
virtual void OnCreateSessionComplete(FName SessionName, bool Succeeded);
virtual void OnFindSessionComplete(bool Succeeded);
virtual void OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result);
UFUNCTION(BlueprintCallable)
void CreateServer();
UFUNCTION(BlueprintCallable)
void JoinServer();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment