内置 Google、Facebook、Discord 等主流第三方登录流程。
UniWebView 自带主流提供商的认证流程辅助组件。Inspector 中配一次 Client ID,调用 StartAuthenticationFlow(),结果通过标准 Unity 事件回调 —— token 已类型化,无需自行处理跳转 URL。
阅读文档 ↗using UnityEngine;
public class GoogleSignIn : MonoBehaviour {
void Start() {
var flow = GetComponent<UniWebViewAuthenticationFlowGoogle>();
flow.StartAuthenticationFlow();
}
public void OnGoogleTokenReceived(UniWebViewAuthenticationGoogleToken token) {
Debug.Log("Access token: " + token.AccessToken);
}
public void OnGoogleAuthError(long errorCode, string errorMessage) {
Debug.LogError("Auth failed: " + errorCode + " " + errorMessage);
}
}