Version: 5.6
Android 清单
Facebook Player Settings

Facebook 开发入门

Facebook 构建目标是什么?

The Facebook build target makes it easy to publish Unity games to Facebook and to use Facebook functionality in your games. Using the Facebook build target, you can build your content either as a WebGL player, which you can then publish to facebook.com, or as a custom native Windows Standalone player, which you can the publish to the Facebook Gameroom client.

选择 Facebook 构建目标后,可自动访问脚本中的 Facebook SDK,这样便可与 Facebook 进行交互并访问其社交功能。

将游戏发布到 Facebook

配置

To publish your game to Facebook, you first need to create a new App on the Facebook developer page. Once completed, this will give you an AppID, which you should paste into your Facebook PlayerSettings. Now, you can get an Upload access token from Facebook, on your app configuration page, under the Web Hosting tab. Also paste this into your Facebook Player Settings. This will allow you to upload your game to Facebook directly from the Unity Editor.

构建

可通过 Build Settings 对话框(菜单:__File__ > Build Settings…__)访问 Facebook 构建设置。在该对话框中,从 Platform__ 列表中选择 Facebook

在此处,可选择将内容构建为 WebGL 或适用于 Gameroom 的 Windows 独立平台。如果计划上传游戏,请选择 __Package build for uploading__,此选项将生成可上传到 Facebook 的压缩包。

进行构建后,__Upload last build to Facebook__ 按钮将变为可用状态。如果已正确配置 AppID 和上传访问令牌,可单击此按钮将构建上传到 Facebook。Enter Comment for upload 字段可用于指定可选的备注信息以描述该构建。

将构建上传到 Facebook 后,它将显示在 Facebook 的应用程序配置页面的 Web Hosting 选项卡下。在此处,可选择将构建推送到生产阶段,或分阶段部分推广到较小比例的用户。

使用 Facebook SDK

When the Facebook build target is active, you can use the Facebook SDK in your scripts. This lets you share content on Facebook, track analytics events, use Facebook Payments and more. See Facebook’s documentation for more information on how to use the SDK.

Which version of the SDK to use can be selected in the Facebook PlayerSettings, which will show all versions which Facebook has made available for your version of Unity.

使用自定义的 Facebook SDK

如果要使用其他版本的 Facebook SDK 而非 Unity 默认包含的 Facebook SDK,这是允许的,只要版本不低于 7.9.1(因此支持 Facebook 构建目标)即可。只需从 Facebook 下载一个 SDK 版本,并将其拖入 Assets 文件夹。Unity 将检测到这一版本,并禁用内置的 SDK。这样就可以使用 Facebook 构建目标之外的 Facebook SDK,让您能够在 Facebook 支持的其他平台上使用 Facebook 功能。



Android 清单
Facebook Player Settings
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961