Im sure my issue has been asked before so I apologize in advance. If someone can help me get this working, I will reward points!!!
Okay so I downloaded a file for this app im making. Its supposed to enable a reward ad for the specific app I am working on (the template im using for the app is made by the same guy with the downloaded pluggin) so I assume the code should all be correct as it works for him in the tutorial. Basically I have a button on my main menu that when clicked should show an ad and give the user 50 coins when finished watching it. Ill upload a pic of the Watch Video Button's Inspector Panel. You can see in the Inspector that the only thing to it is that "On Click" it is performing the "ServiceCalling.WatchVideoAd" from the ServiceCalling script (this script is attached to what appears to be an empty game object). Here is the code that is in the Service Calling Script:
using UnityEngine;
using System.Collections;
public class ServiceManager : MonoBehaviour {
public static ServiceManager Instance;
private GameObject _AdsController, _UnityAds, _IAP, _Facebook;
void Awake(){
if (ServiceManager.Instance != null)
Destroy (gameObject); //just allow one adscontroller on scene over gameplay, even when you restart this level
else {
Instance = this;
DontDestroyOnLoad (gameObject);
}
}
// Use this for initialization
void Start () {
// if (gameObject.transform.childCount == 0) {
// Debug.LogError ("There are no any service object, please read the Tutorial file to setup the service");
// return;
// }
// if (GameObject.Find ("AdsController") != null)
_AdsController = GameObject.Find ("AdsController");
// if (GameObject.Find ("UnityAds") != null)
_UnityAds = GameObject.Find ("UnityAds");
//
//
//// _IAP = transform.Find ("IAP").gameObject;
_Facebook = GameObject.Find ("Facebook");
}
public void ShowAds(){
if (_AdsController != null) {
// if (!GlobalValue.RemoveAds)
_AdsController.SendMessage ("ShowAds");
}
else
Debug.Log ("There is no AdsController object in the scene, please read the Tutorial file for more information");
}
public void HideAds(){
if (_AdsController != null)
_AdsController.SendMessage ("HideAds");
else
Debug.Log ("There is no AdsController object in the scene, please read the Tutorial file for more information");
}
**public void ShowRewardAds(){
if (_UnityAds != null)
_UnityAds.SendMessage ("ShowRewardVideo");
else
Debug.Log ("There is no UnityAds object in the scene, please read the Tutorial file for more information");
}**
So thats all the code. Now for the issue. When I click the Watch Video Button in my game I get this message.
**SendMessage ShowRewardVideo has no receiver!**
UnityEngine.GameObject:SendMessage(String)
ServiceManager:ShowRewardAds() (at Assets/Kong Hero/Script/ServiceManager.cs:54)
ServiceCalling:WatchVideoAds() (at Assets/Kong Hero/Script/ServiceCalling.cs:15)
UnityEngine.EventSystems.EventSystem:Update()
Does anyone know how to get the "reciever"? The first line in the error message comes directly from the ServiceManager Script (the other bolded bit above). There is a little bit more to it but Im sure I already gave an overwhelming amount of information. I apologize and if I cant get this fixed then ill have to find a new tutorial just for reward ads. Thank you so much guys![alt text][1]
[1]: /storage/temp/106620-capture.jpg
↧