**I am working on my FYP so Kindly help me out **
Using Gley Ads package for Ads This same code work file in an other game of mine but not on this one the ads prefab is Instantiate but the Ads manager script is SetActive(False) it is suppose to be active
Error
NullReferenceException: Object reference not set to an instance of an object
Gley.MobileAds.Internal.MobileAdsManager.Initialize (UnityEngine.Events.UnityAction completeMethod) (at Assets/Gley/MobileAds/Scripts/Internal/MobileAdsManager.cs:153)
Gley.MobileAds.API.Initialize (UnityEngine.Events.UnityAction completeMethod) (at Assets/Gley/MobileAds/Scripts/ToUse/APIMobileAds.cs:16)
AdManager.Awake () (at Assets/Gley/AdManager.cs:12)
UnityEngine.Object:Instantiate(GameObject)
Home:Start() (at Assets/Scripts/Home/Home.cs:70)
Code
using UnityEngine;
using System;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Home : MonoBehaviour
{
public GameObject PlayBtn, SettingBtn, ShopBtn;
public GameObject SettingPnl, ExitPnl, LevelPnl, ShopPnl, HighScoreBoard;
public Text HighScore ;
private bool isPnlOpen = false;
[Header("UI Pnl's")]
public GameObject CurPnl;
[Header("Prefabs")]
public GameObject Sound;
public GameObject Ads;
[Header("Setting")]
public Image[] SettingIcons;
public Sprite[] OnOffIcon;
void Awake()
{
if (!GlobalValues.isPrefabsActice)
{
DontDestroyOnLoad(Instantiate(Ads));
DontDestroyOnLoad(Instantiate(Sound));
GlobalValues.isPrefabsActice = true;
}
iTween.ScaleTo(PlayBtn, iTween.Hash("scale", Vector3.one, "time", 0.5f, "easetype", "spring", "delay", 0.2f, "oncomplete", nameof(LowerBar), "oncompletetarget", gameObject));
InitialSetting();
}
public void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
if (CurPnl.activeSelf == true)
closepanel(CurPnl);
else
if (ExitPnl.activeInHierarchy == false)
openPanel(ExitPnl);
}
}
private void Start()
{
HighScore.text = GlobalValues.isHighScore.ToString();
}