-
Notifications
You must be signed in to change notification settings - Fork 2
Unity Plugin
shahafss edited this page Sep 13, 2017
·
23 revisions
- Download or clone whole
SDK-Pluginsproject and ExtractSDK-Plugins/Unitycontent into a temporary directory. - In your Unity project, create folder
Assets/Plugins/Android.
Copy the following fromSDK-Plugins/Unity/MobFox-Unity-Demo/Assets/Plugins/Androidinto that directory:
-
AndroidManifest.xml file
-
libs directory (and content)
-
res directory (and content)
- In your Unity project, create a folder
Assets/Scripts.
Copy the following file from Scripts directory into that directory:MobFox.cs
- In your Unity project, create a game object called
MobFoxObject.
Attach the MobFox script to it. - Fill the
Mob Fox Banner Inventory Hashfield with your banner inventory hash. - Fill the
Mob Fox Interstitial Inventory Hashfield with your Interstitial inventory hash. - Fill the
Mob Fox Game Object Namefield with the name of the game object if you use one other thanMobFoxObject. - Fill the
Top, Leftfields with your location preferences. - Fill the
Width, Heightfields with your banner size (default 320x50).
- Use
MobFox.ShowMobFoxBannerto display a banner ad. - Use
MobFox.HideMobFoxBanner,MobFox.UnhideMobFoxBannerto hide / unhide a banner ad. - Use
MobFox.CreateAndShowMobFoxInterstitialto display a interstitial ad. - To only load the interstitial use
MobFox.CreateMobFoxInterstitial.
show the interstitial in theinterstitialReadyevent with theMobFox.ShowMobFoxInterstitialmethod. - To load a native ad use
MobFox.ShowMobFoxNative - Find callback functions in MobFox script to handle events:
- banner:
- bannerReady
- bannerError
- bannerClosed
- bannerClicked
- bannerFinished
- interstitial:
- interstitialReady
- interstitialError
- interstitialClosed
- interstitialClicked
- interstitialFinished
- native:
- nativeReady (see demo code for how to get the native components from the passed param)
- nativeError
- By default, use of location info is disabled. To enable it, you can call
MobFox.SetUseLocation(true).
- Unity with MobFox demo app is available. With Banner, Interstitial and native test ads integrated, its highly recommended to use this as reference.
This feature lets you develop with unity and use MobFox's SDK.
Run Unity Demo project : https://github.com/mobfox/MobFox-iOS-SDK-Core-Lib/tree/master/Plugins/UnityDemo
Instructions:
- In your Unity project, create a folder
Assets/Plugin/iOS. Copy to that directory the filesMobFoxUnityPlugin.h,MobFoxUnityPlugin.mmandMobFoxSDKCore.frameworkfromSDK-Plugins/Unity/MobFox-Unity-Demo/Assets/Plugins/iOS/:
MobFoxSDKCore.frameworkMobFoxUnityPlugin.hMobFoxUnityPlugin.mm
- In your Unity project, create a folder
Assets/Scripts. Copy the following file from Scripts directory into that directory:MobFox.cs
- Make sure
AdSupport.frameworkandlibz.dylibare included in your project's frameworks. - In your Unity project, create a game object called
MobFoxObject.
Attach the MobFox script to it. - Fill the
Mob Fox Banner Inventory Hashfield with your banner inventory hash. - Fill the
Mob Fox Interstitial Inventory Hashfield with your Interstitial inventory hash. - Fill the
Mob Fox Game Object Namefield with the name of the game object if you use one other thanMobFoxObject. - Fill the
Top, Leftfields with your location preferences. - Fill the
Width, Heightfields with your banner size (default 320x50).
- Use
MobFox.ShowMobFoxBannerto display a banner ad. - Use
MobFox.HideMobFoxBanner,MobFox.UnhideMobFoxBannerto hide / unhide a banner ad. - Use
MobFox.CreateAndShowMobFoxInterstitialto display a interstitial ad. - To only load the interstitial use
MobFox.CreateMobFoxInterstitial.
show the interstitial in theinterstitialReadyevent with theMobFox.ShowMobFoxInterstitialmethod. - To load a native ad use
MobFox.ShowMobFoxNative - Find callback functions in MobFox script to handle events:
- banner:
- bannerReady
- bannerError
- bannerClosed
- bannerClicked
- bannerFinished
- interstitial:
- interstitialReady
- interstitialError
- interstitialClosed
- interstitialClicked
- interstitialFinished
- native:
- nativeReady (see demo code for how to get the native components from the passed param)
- nativeError
- By default, use of location info is disabled. To enable it, you can call
MobFox.SetUseLocation(true).
- Unity with MobFox demo app is available. With Banner, Interstitial and native test ads integrated, its highly recommended to use this as reference.