Put it all together - Login with Steam - (Unity module)
Last updated on November 25, 2024
info
This tutorial module does not apply to WebGL builds due to limitations in Steamworks.
Connect the UI to let player log in with Steam
In this tutorial, you will connect Steam login functionality from the SinglePlatformAuthWrapper_Starter
wrapper to the button that resides in the LoginMenuCanvas prefab.
Open
SinglePlatformAuthWrapper_Starter
. You can connect the Steam login button to the login function. Since you rely on an existing menu canvas inLoginHandler
to set the loading state and the retry button callback, you will set them first before getting the Steam authentication session ticket. Copy the highlighted code below intoSinglePlatformAuthWrapper_Starter
.private void OnLoginWithSteamButtonClicked()
{
if (loginHandler == null) return;
loginHandler.OnRetryLoginClicked = OnLoginWithSteamButtonClicked;
loginHandler.SetView(LoginHandler.LoginView.LoginLoading);
//get steam token to be used as platform token later
steamHelper.GetAuthSessionTicket(OnGetAuthSessionTicketFinished);
}
Resources
- The file used in this tutorial section is available in the Unity Byte Wars GitHub repository.