[英]Facebook Unity SDK on Android crashes when fb.init is called
我正在使用facebook unity SDK,在unity editor上一切正常,但在android設備上不起作用。 調用fb.init時“應用已停止”。
我使用統一5.5.1版本,facebook sdk版本為7.9.4
這是代碼:
public void teststr()
{
if (!FB.IsInitialized) {
// Initialize the Facebook SDK
FB.Init(InitCallback, OnHideUnity);
} else {
// Already initialized, signal an app activation App Event
}
}
private void InitCallback ()
{
if (FB.IsInitialized) {
// ...
} else {
}
}
private void OnHideUnity (bool isGameShown)
{
if (!isGameShown) {
// Pause the game - we will need to hide
Time.timeScale = 0;
} else {
// Resume the game - we're getting focus again
Time.timeScale = 1;
}
}
單擊按鈕時將觸發teststr函數
我解決了!
我使用FB.Init(this.InitCallback, this.OnHideUnity);
而不是FB.Init(InitCallback, OnHideUnity);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.