Search code examples
unreal-development-kitunrealscript

How do I correct a "const mismatch in out variable"?


So I'm currently writing code to access a player's uniqueNetId using:

Class'GameEngine'.static.GetOnlineSubsystem().UniqueNetIdToString(
        OnlineSubsystemSteamworks(Class'GameEngine'.static.GetOnlineSubsystem()).LoggedInPlayerId.Uid);

But that leads to this:

Error, Call to 'UniqueNetIdToString', parameter 1: Const mismatch in Out variable

Does anybody have any idea what I'm doing wrong?


Solution

  • It's not actually a const mismatch. The function is expecting a struct and you are passing in a member of the struct instead. Try removing the .Uid, i.e.:

    Class'GameEngine'.static.GetOnlineSubsystem().UniqueNetIdToString(
            OnlineSubsystemSteamworks(Class'GameEngine'.static.GetOnlineSubsystem()).LoggedInPlayerId);