Again, I’m trying to follow Shooter demo in trying to create a network game. From the code:
AShooterGameSession* Session = Cast<AShooterGameSession>(GameSession);
if (Session)
{
// Host/create new session
}
I couldn’t find where the [GameSession] was declared. So I tried to use [GameMode->GameSession] instead, but once [GameMode->GameSession] is casted into a custom game session, it always returned null and refused to go anywhere.
So I’m wondering about how to properly create or initialized a custom game session.
My thanks in advance if someone could help guide us with some pointers.
Best.
Never mind, we needed this in place. Everything works nicely now…
virtual TSubclassOf<AGameSession> GetGameSessionClass() const OVERRIDE; // .h
TSubclassOf<AGameSession> AShooterGameMode::GetGameSessionClass() const // .ccp
{
return AShooterGameSession::StaticClass();
}
I am having a similar problem, my GameSession is always coming back as 0x00000000
In the shootergame example, the GameSession variable is a valid memory address with values set, yet in my tests, I cannot seem to get this to behave. Are you able to explain in more detail how you fixed this issue?
many thanks!
Might be a silly question here guys, but how is it you guys debug your GameSession? Since whenever I debug it opens up the editor, i have no way of checking my GameSession’s value.