I’m trying to get the FOnlineSubsystemSteam singleton so I can detect if Steam is initialized before I try to host/join a multiplayer game and pop up an error if it’s not. When I call IOnlineSubsystem::Get() and try to use Cast on the result I just get the compiler error:
2>C:\Program Files\Epic Games\4.9\Engine\Source\Runtime\CoreUObject\Public\Templates\Casts.h(176): error C2664: 'FOnlineSubsystemSteam *TCastImpl<From,To,UObjectToUObject>::DoCast(UObject *)' : cannot convert argument 1 from 'IOnlineSubsystem *' to 'UObject *'
2> with
2> [
2> From=IOnlineSubsystem
2> , To=FOnlineSubsystemSteam
2> ]
2> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
2> C:\EGS\DeathTractor\Source\DeathTractor\DTBPLibrary.cpp(127) : see reference to function template instantiation 'To *Cast<FOnlineSubsystemSteam,IOnlineSubsystem>(From *)' being compiled
2> with
2> [
2> To=FOnlineSubsystemSteam
2> , From=IOnlineSubsystem
2> ]
I know FOnlineSubsystemSteam inherits from IOnlineSubsystem so I’m not sure why this is failing. What modules do I need to include in my project or headers in the file to get this working? Or is there some other way I can find out if the Steamworks API is initialized?