Skip to content

Instantly share code, notes, and snippets.

@revmob-sdk
Last active September 12, 2016 17:30
Show Gist options
  • Save revmob-sdk/3455480 to your computer and use it in GitHub Desktop.
Save revmob-sdk/3455480 to your computer and use it in GitHub Desktop.
RevMob Unity SDK
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObject : MonoBehaviour
{
// ...
void Start() {
#if (UNITY_IPHONE && !UNITY_EDITOR)
RevMobIOSBAnner banner = revmob.CreateBanner();
banner.Show();
#endif
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObject : MonoBehaviour
{
// Just replace the IDs below with your appIDs.
private static readonly Dictionary<String, String> appIds = new Dictionary<String, String>() {
{ "Android", "4f56aa6e3dc441000e005a20"},
{ "IOS", "4fd619388d314b0008000213" }
};
private RevMob revmob;
void Awake() {
Debug.Log("Creating RevMob Session");
revmob = RevMob.Start(appIds);
}
}
import System.Collections.Generic;
private var APP_IDS = new Dictionary.<String, String>();
private var revmob:RevMob;
function Awake() {
// Just replace the ID below with your appID.
APP_IDS["Android"] = "4f56aa6e3dc441000e005a20";
APP_IDS["IOS"] = "4fd619388d314b0008000213";
Debug.Log("[RevMob Sample App - JavaScript] Starting Session");
revmob = RevMob.Start(APP_IDS, "GameObject");
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObject : MonoBehaviour
{
// ...
void Start() {
revmob.ShowPopup();
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RevMobGameObject : MonoBehaviour, IRevMobListener
{
// Just replace the IDs below with your appIDs.
private static readonly Dictionary<String, String> appIds = new Dictionary<String, String>() {
{ "Android", "4f56aa6e3dc441000e005a20"},
{ "IOS", "4fd619388d314b0008000213" }
};
private RevMob revmob;
public void Awake() {
revmob = RevMob.Start(appIds, "RevMobGameObject");
}
public void Update() {
// ...
}
#region IRevMobListener implementation
public void AdDidReceive (string revMobAdType)
{
Debug.Log("Ad did receive.");
}
public void AdDidFail (string revMobAdType)
{
Debug.Log("Ad did fail.");
}
public void AdDisplayed (string revMobAdType)
{
Debug.Log("Ad displayed.");
}
public void UserClickedInTheAd (string revMobAdType)
{
Debug.Log("Ad clicked.");
}
public void UserClosedTheAd (string revMobAdType)
{
Debug.Log("Ad closed.");
}
public void InstallDidReceive (string revMobAdType)
{
// Do not implement.
}
public void InstallDidFail (string revMobAdType)
{
// Do not implement.
}
#endregion
}
import System.Collections.Generic;
private var APP_IDS = new Dictionary.<String, String>();
private var revmob:RevMob;
function Awake() {
// Just replace the ID below with your appID.
APP_IDS["Android"] = "4f56aa6e3dc441000e005a20";
APP_IDS["IOS"] = "4fd619388d314b0008000213";
Debug.Log("[RevMob Sample App - JavaScript] Starting Session");
revmob = RevMob.Start(APP_IDS, "GameObject");
}
function Start() {
if ( revmob.IsDevice() ) {
Debug.Log("[RevMob Sample App - JavaScript] Show Fullscreen");
revmob.ShowFullscreen();
}
}
function AdDidReceive(adUnitType) {
Debug.Log("[RevMob Sample App - JavaScript] Ad did received");
}
function AdDidFail(adUnitType) {
Debug.Log("[RevMob Sample App - JavaScript] Ad did not received");
}
function AdDisplayed(adUnitType) {
Debug.Log("[RevMob Sample App - JavaScript] Ad displayed");
}
function UserClickedInTheAd(adUnitType) {
Debug.Log("[RevMob Sample App - JavaScript] Ad clicked");
}
function UserClosedTheAd(adUnitType) {
Debug.Log("[RevMob Sample App - JavaScript] Ad closed");
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObject : MonoBehaviour
{
// ...
void Start() {
revmob.ShowFullscreen();
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObject : MonoBehaviour
{
private static readonly string PLACEMENT_ID = "5058bc5f5d9fb60800000001";
// ...
void Start() {
revmob.ShowFullscreen(PLACEMENT_ID);
}
}
// scenario of success: with ads
revmob = RevMob.SetTestingMode(RevMob.Test.WITH_ADS);
// scenario of failure: without ads
revmob = RevMob.SetTestingMode(RevMob.Test.WITHOUT_ADS);
@kiempoturner
Copy link

So do i attach all these in the same gameobject?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment