誰でもFBNativeAdBridgeCallback関数の使い方を教えてください。私は基本的に、画像がロードされて表示できるようになったときを知りたいと思っています。 。そうでなければ、Facebookが読み込みを完了するまで、空の値でネイティブのバナーを飛ばしています。各画像/テキストが一度に1つずつ読み込まれると、実際には見苦しいように見えます。誰でも、視聴者ネットワークのユニティでFBNativeAdBridgeCallback関数を使用する方法を知っています
これは基本的なネイティブ広告のサンプルスクリプトですが、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)
// {
//
// }
}
ありがとうございます!
「画像がロードされた」とはどういう意味ですか?バナー広告が読み込まれるようにしますか? –
@NikaKasradze公開オブジェクトに実際の値がいつ含まれているかを知りたい。そうでなければ、Facebookが読み込みを完了するまで、空の値でネイティブのバナーを飛ばしています。各画像/テキストが一度に1つずつ読み込まれると、実際には見苦しいように見えます。 –