简体   繁体   English

使用Facebook登录统一PC独立版

[英]Using Facebook Login unity PC Standalone Build

I have decided to go with PC standalone build becauce I had no luck with WebGL and facebook, because my build in WebGL is getting too big for a web game. 我决定使用PC独立版本,因为我对WebGL和Facebook没有运气,因为我在WebGL中的版本对于网络游戏来说太大了。

However when I push my "Login with Facebook" button, nothing happens on the PC standalone build. 但是,当我按下“使用Facebook登录”按钮时,在PC独立版本上没有任何反应。 How can I use the Facebook SDK with Unity's PC standalone build? 如何将Facebook SDK与Unity的PC独立构建一起使用?

I am pretty sure Facebook does not support PC builds. 我敢肯定,Facebook不支持PC版本。 Simply looking at the source code of the SDK is enough to see that they simply have no implemented handlers for PC: 仅查看SDK的源代码就足以看到它们根本没有为PC实现的处理程序:

#if UNITY_EDITOR
ComponentFactory.GetComponent<EditorFacebookLoader>();
#elif UNITY_WEBPLAYER || UNITY_WEBGL
ComponentFactory.GetComponent<CanvasFacebookLoader>();
#elif UNITY_IOS
ComponentFactory.GetComponent<IOSFacebookLoader>();
#elif UNITY_ANDROID
ComponentFactory.GetComponent<AndroidFacebookLoader>();
#else
throw new NotImplementedException("Facebook API does not yet support this platform");
#endif

This is why "Login with Facebook" button does nothing in your build. 这就是为什么“使用Facebook登录”按钮在构建中不执行任何操作的原因。

You could try implementing everything manually. 您可以尝试手动实施所有操作。 You can work with Facebook using graph API https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5 您可以使用图形API https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5与Facebook合作

So you can use Unity WWW class to access various graph API nodes. 因此,您可以使用Unity WWW类访问各种图形API节点。

However you still an access token to use it, so you have to login somehow, and you have to pass through Facebook login dialog, which you don't have for your platform. 但是,您仍然可以使用它作为访问令牌,因此您必须以某种方式登录,并且必须通过Facebook登录对话框,而该对话框对于您的平台是没有的。 So the best bet would embed browser in your game (there are some plugins that can do it), and do all the client side login flow via javascript https://developers.facebook.com/docs/facebook-login/web or manual login flow https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow 因此,最好的选择是将浏览器嵌入您的游戏中(有一些插件可以做到),并通过javascript https://developers.facebook.com/docs/facebook-login/web或手册完成所有客户端登录流程登录流程https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow

The same problem will occur if you are planning to use some standard dialogs, such as share or invite. 如果您计划使用某些标准对话框(例如共享或邀请),则会发生相同的问题。

And last, your Facebook must be approved by Facebook review team before going public. 最后,您的Facebook必须在公开之前获得Facebook审核小组的批准。 I am seriously don't know how you are going to get this approval, since you are using an unsupported platform. 我很不知道您将如何获得此批准,因为您使用的是不受支持的平台。

So this is what you will have to do to achieve what you want. 因此,这是您要实现所需目标所要做的。 Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM