IOnlineSubsystem::Get() crashes on editor

I am trying to validate the instance of online subsystem interface.

it works fine in a standalone executable.
But in the editor it crashes.

So some instance inside this function must be null when executed in the editor.

Then I tried to do some checks to prevent IOnlineSubsystem::Get() from being executed when in the editor.

1

However the first two checks return true and IOnlineSubsystem::Get() is executed and then BOOM!!!

So it’s obvious I’m not doing the correct checks.

What is the correct way to check this?

Thank you so much!!


I think that the ideal is to use the default OnlineSubsystemNULL in the editor and in standalone OnlineSubsystemEOS. I thought this would happen internally automatically. But I suspect that this is not the case, and that this is what is causing this problem. (It’s just a guess)

If I am correct, maybe it is necessary to change some configuration in “DefaultEngine.ini”


Here is my current configuration:

[/Script/Engine.Engine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName=“OnlineSubsystemEOS.NetDriverEOS”,DriverClassNameFallback=“OnlineSubsystemUtils.IpNetDriver”)

[OnlineSubsystem]
DefaultPlatformService=EOS

[OnlineSubsystemEOS]
bEnabled=true

[OnlineServices]
DefaultServices=Epic

[OnlineServices.EOS]
bUseEAS=false

[/Script/OnlineSubsystemUtils.OnlineEngineInterfaceImpl]
!CompatibleUniqueNetIdTypes=ClearArray
+CompatibleUniqueNetIdTypes=EOS

[/Script/OnlineSubsystemEOS.EOSSettings]
CacheDir=CacheDir
DefaultArtifactName=…
TickBudgetInMilliseconds=0
bEnableOverlay=True
bEnableSocialOverlay=True
bShouldEnforceBeingLaunchedByEGS=False
TitleStorageReadChunkLength=1600
;+Artifacts=(ArtifactName=“…”,
ProductId=“…”,
SandboxId=“…,
DeploymentId=”…“,
EncryptionKey=”…")
bUseEAS=True
bUseEOSConnect=True
bMirrorStatsToEOS=True
bMirrorAchievementsToEOS=True
bUseEOSSessions=True
bMirrorPresenceToEAS=True
bEnableEditorOverlay=True

[/Script/OnlineSubsystemEOS.NetDriverEOS]
bIsUsingP2PSockets=true

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName=“GameNetDriver”,DriverClassName=“OnlineSubsystemEOS.NetDriverEOS”,DriverClassNameFallback=“OnlineSubsystemUtils.IpNetDriver”)


Maybe there is something wrong in my DefaultEngine.ini?

Thank you so much!!

I think this could be part of the solution.

2

However it keeps crashing.

-The first time it runs, it loads EOS and it doesn’t crash, it even logs in successfully, which is strange to me because I thought that the EOS didn’t work on editor.

-The second time I click play, it doesn’t load EOS and it doesn’t log in,… but it doesn’t load OnlineSubsystemNULL either and it crashes.

So I’m not sure what’s going on.

  • Maybe I have something misconfigured.
  • Or maybe the editor doesn’t free the memory completely when I click the stop button.

Does anyone have any idea what is going on?

Thank you so much!!

In what class/where are you running this code? Sounds like it’s running outside of game code.

I implemented the EOS code in GameInstance. Then I made a blueprint for tests… we can say that it is the main menu…

Works perfectly in standalone executable.

In the editor it works fine too, but only the first time.

I’m starting to think that there is a cache or something like that… I was looking for an option to clear that cache in the editor options but I haven’t found anything about it.

Or maybe the garbage collector didn’t do its job (I don’t know)… Maybe I should try to clean the memory by myself…

The impression I get right now is that the editor creates an instance of the game and doesn’t destroy it when the Stop button is clicked… I don’t really know, but I think a hard reset would fix the problem.

Maybe I am very wrong, really they are only suppositions.

Thank you so much!!

I found that it was all a logic error.

When I ran it in standalone there were no problems because when the application is closed everything is destroyed and the session is closed automatically.

However in the editor it does not work this way.

It was necessary to loguot in this way.
1

So when I hit the play button for the second time, the new session starts. And new instances of the objects are created.

there are no more crashes.

However, I’m still looking for a way to validate the IOnlineSubsystem.

That is, I need to know if something is valid/null before executing this.

IOnlineSubsystem::Get()

So I can have a controlled termination in case of problems.

Do you know how to do it?
Thank you so much!!