By default, the CloudService will automatically authenticate as a Guest User, unless you disable Auto Login As Guest option in the CoherenceBridge inspector.
If you disable the automatic login, you can handle Player authentication manually through the CloudService.GameServices.AuthService API.
In this example, you can see how you can manually login as a Guest:
usingSystem.Threading.Tasks;usingCoherence.Cloud;usingCoherence.Toolkit;usingUnityEngine;publicclassLoginAsGuestExample:MonoBehaviour{publicCoherenceBridge bridge;privateCloudService cloudService;asyncvoidStart() { cloudService =bridge.CloudService;awaitLogin(); // At this point, we are ready to fully utilize the Cloud Service }privateasyncTaskLogin() {var authService =cloudService.GameServices.AuthService;var result =awaitauthService.LoginAsGuest();if (result.LoggedIn) {Debug.Log($"Logged in as: {result.Username}",this); }else {Debug.LogError(result,this); } }}
You can also choose to allow your users to create their own Player accounts, you can use the Authentication Service API in a similar fashion to allow for manual authentication:
usingCoherence.Cloud;usingCoherence.Toolkit;usingSystem.Collections;usingUnityEngine;usingResult=Coherence.Runtime.Result;usingSystem.Threading.Tasks;usingCoherence.Cloud;usingCoherence.Toolkit;usingUnityEngine;publicclassLoginAsUserExample:MonoBehaviour{publicCoherenceBridge bridge;publicstring username;publicstring password;privateCloudService cloudService;asyncvoidStart() { cloudService =bridge.CloudService;awaitLogin(); // At this point, we are ready to fully utilize the Cloud Service }privateasyncTaskLogin() {var authService =cloudService.GameServices.AuthService;var result =awaitauthService.LoginWithPassword(username, password,true);if (result.LoggedIn) {Debug.Log($"Logged in as: {username}",this); }else {Debug.LogError(result,this); } }}