C# 有人知道如何在观众网络统一中使用FBNativeAdBridgeCallback函数吗

C# 有人知道如何在观众网络统一中使用FBNativeAdBridgeCallback函数吗,c#,facebook,unity3d,facebook-audience-network,C#,Facebook,Unity3d,Facebook Audience Network,有谁能告诉我如何使用FBNativeAdBridgeCallback函数吗?我基本上想知道图像何时完成加载,以便我可以显示它们。否则我会有一个本地横幅,上面有空值,直到Facebook加载完毕。如果每个图像/文本一次加载一个,它看起来真的很难看 这只是基本的原生ads示例脚本,我尝试像登录时一样使用IResult,但这会使它变红。互联网上没有关于这个的文档,甚至在Facebook开发者网站上也没有,我根本找不到api 有人能给我解释一下如何在下面提供的脚本中使用它吗 using UnityEng

有谁能告诉我如何使用FBNativeAdBridgeCallback函数吗?我基本上想知道图像何时完成加载,以便我可以显示它们。否则我会有一个本地横幅,上面有空值,直到Facebook加载完毕。如果每个图像/文本一次加载一个,它看起来真的很难看

这只是基本的原生ads示例脚本,我尝试像登录时一样使用IResult,但这会使它变红。互联网上没有关于这个的文档,甚至在Facebook开发者网站上也没有,我根本找不到api

有人能给我解释一下如何在下面提供的脚本中使用它吗

using UnityEngine;
using UnityEngine.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using AudienceNetwork;

[RequireComponent (typeof(CanvasRenderer))]
[RequireComponent (typeof(RectTransform))]
public class NativeAdTest : MonoBehaviour
{
    private NativeAd nativeAd;

    // UI elements in scene
    [Header("Text:")]
    public Text
        title;
    public Text socialContext;
    [Header("Images:")]
    public Image
        coverImage;
    public Image iconImage;
    [Header("Buttons:")]
    public Text
        callToAction;
    public Button callToActionButton;

    public GameObject hide;

    void Awake ()
    {
        // Create a native ad request with a unique placement ID (generate your own on the Facebook app settings).
        // Use different ID for each ad placement in your app.
        NativeAd nativeAd = new AudienceNetwork.NativeAd ("your placement id");
        this.nativeAd = nativeAd;

        // Wire up GameObject with the native ad; the specified buttons will be clickable.
        nativeAd.RegisterGameObjectForImpression (gameObject, new Button[] { callToActionButton });

        // Set delegates to get notified on changes or when the user interacts with the ad.
        nativeAd.NativeAdDidLoad = (delegate() {
            Debug.Log ("Native ad loaded.");
            Debug.Log ("Loading images...");
            // Use helper methods to load images from native ad URLs
            StartCoroutine (nativeAd.LoadIconImage (nativeAd.IconImageURL));
            StartCoroutine (nativeAd.LoadCoverImage (nativeAd.CoverImageURL));
            Debug.Log ("Images loaded.");
            title.text = nativeAd.Title;
            socialContext.text = nativeAd.SocialContext;
            callToAction.text = nativeAd.CallToAction;
            Debug.Log ("Native ad Luke.");
        //  hide.SetActive(false);
            //FBNativeAdBridgeCallback


        });
        nativeAd.NativeAdDidFailWithError = (delegate(string error) {
            Debug.Log ("Native ad failed to load with error: " + error);
        });
        nativeAd.NativeAdWillLogImpression = (delegate() {
            Debug.Log ("Native ad logged impression.");
        });
        nativeAd.NativeAdDidClick = (delegate() {
            Debug.Log ("Native ad clicked.");
        });



        // Initiate a request to load an ad.
        nativeAd.LoadAd ();
        //nativeAd.nat
    }

    void OnGUI ()
    {
        // Update GUI from native ad
        coverImage.sprite = nativeAd.CoverImage;
        iconImage.sprite = nativeAd.IconImage;
    }

    void OnDestroy ()
    {
        // Dispose of native ad when the scene is destroyed
        if (this.nativeAd) {
            this.nativeAd.Dispose ();
        }
        Debug.Log ("NativeAdTest was destroyed!");
    }

//  void FBNativeAdBridgeCallback(IResult result)
//  {
//      
//  }

}

提前感谢

AdView
不允许您从
FBNativeAdBridgeCallback()
定义自定义侦听器
AdView
已经提供了5个回调,包括
NativeAdDidLoad()


您的问题的解决方案是先隐藏广告,然后在收到
nativeaddiload()
并完成图像加载后,将广告放在前面并使其可见。无需创建新的
FBNativeAdBridgeCallback()

您所说的“图像已完成加载”是什么意思?那么横幅广告被加载了?@NikaKasradze我想知道公共对象何时包含实际值。否则我会有一个本地横幅,上面有空值,直到Facebook加载完毕。如果每个图像/文本一次加载一个,它看起来真的很难看。问题是协同程序从NativeAdDidLoad()内部开始,所以当我使adView可用时,即使我在Debug.Log(“Native ad Luke”)之后使其可用,协同程序仍然忙于加载图像显示-仍然可以看到封面图像加载,然后按钮名称更改等。。。那么,当我可以展示广告时,我如何获得反馈呢?