I’ve made sure that the path in the TSoftObjectPath is correct… The code is being run in a server RPC if that makes any difference. Does anyone know what might be happening here?
@Jambax unfortunately I don’t think that’s the case as I do a check on controller first to make sure it’s not nullptr.
All of this happens, and then the game errors out specifically when I try to access SidekickAIControllerClass.
if (Controller)
{ Controller->Sidekick->GetController()->UnPossess();
UClass* Example = Controller->SidekickAIControllerClass;
Controller->Sidekick->AIControllerClass = Controller->SidekickAIControllerClass.LoadSynchronous();
Controller->Sidekick->SpawnDefaultController();
}
I’m really thinking this is a replication related error as this is the output of the crash. It mentions OnlineSubsystemUtils, and line 86 is the line where it tries to set AIControllerClass to SidekickAIControllerClass:
Ultimately the crash you are getting is caused by dereferencing a nullptr.
The snippet you posted above has a lot of cases of dereferencing pointers without checking they are valid first. Controller might not be null, but what about everything else?