public class Adam : MonoBehaviour { AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject activity; #region Singleton private static Adam sInstance; public static Adam GetInstance { get { if (sInstance == null) sInstance = (Adam)FindObjectOfType(typeof(Adam)); if (sInstance == null) { if (GameObject.Find("Singleton")) { GameObject goInst = GameObject.Find("Singleton"); sInstance = goInst.AddComponent<Adam>(); } else { GameObject goInst = new GameObject("Singleton"); sInstance = goInst.AddComponent<Adam>(); } } return sInstance; } } #endregion public void LoadInterstitial() { activity = jc.GetStatic<AndroidJavaObject>("currentActivity"); activity.Call("LoadInterstitial"); } }Test.cs
public class Test : MonoBehaviour { // Use this for initialization void Start () { Adam.GetInstance.LoadInterstitial(); } }
How to Use.
Adam.cs생성후 다른 스크립트에서 LoadInterstitial() 함수를 호출하면 된다.
0 개의 댓글:
댓글 쓰기