All Projects → unity-plugins → Unity Admob

unity-plugins / Unity Admob

Unity Admob Plugin is Admob SDK plugin for Unity3d ,this plugin make js and c# developer easy to add google ads in Unity3d games,support IOS and Android ,support admob interstitia and banner

Projects that are alternatives of or similar to Unity Admob

twitter-kit-unity
Twitter Kit for Unity
Stars: ✭ 69 (-75.7%)
Mutual labels:  unity3d-plugin
unity-firebase-realtime-database
Unity Firebase Realtime Database REST
Stars: ✭ 24 (-91.55%)
Mutual labels:  unity3d-plugin
Deform Prototype
A prototyped framework for deforming meshes in the editor and at runtime in Unity. Not in development anymore, but it's still pretty awesome!
Stars: ✭ 256 (-9.86%)
Mutual labels:  unity3d-plugin
unityAndroidSensors
Access to android sensors for Unity
Stars: ✭ 14 (-95.07%)
Mutual labels:  unity3d-plugin
ScriptableObjectMultiSelectDropdown
Multi Select Dropdown for ScriptableObjects
Stars: ✭ 18 (-93.66%)
Mutual labels:  unity3d-plugin
UnityDebug
A wrapper script for Unity debug calls to use conditional attributes in order to avoid debug code being compiled into release builds.
Stars: ✭ 29 (-89.79%)
Mutual labels:  unity3d-plugin
SqlCipher4Unity3D
💾 SqlCipher made easy for Unity3d
Stars: ✭ 119 (-58.1%)
Mutual labels:  unity3d-plugin
Realtime Csg For Unity
Realtime-CSG, CSG level editor for Unity
Stars: ✭ 281 (-1.06%)
Mutual labels:  unity3d-plugin
Unity-File-Debug
Enhanced debug logging for Unity, with JSON/CSV export and HTML viewer.
Stars: ✭ 50 (-82.39%)
Mutual labels:  unity3d-plugin
UnityRawInput
Windows Raw Input wrapper for Unity game engine
Stars: ✭ 129 (-54.58%)
Mutual labels:  unity3d-plugin
Zenject-2019
Dependency Injection Framework for Unity3D
Stars: ✭ 2,567 (+803.87%)
Mutual labels:  unity3d-plugin
Simple-Unity-Audio-Manager
A decentralized audio playing system for Unity, designed for simplicity and built to scale!
Stars: ✭ 100 (-64.79%)
Mutual labels:  unity3d-plugin
MoonMotion
Moon Motion Toolkit - Free and open source toolkit for VR locomotion
Stars: ✭ 38 (-86.62%)
Mutual labels:  unity3d-plugin
PrefabEditor
You can edit Prefab which could not be edited much unless you place it on Scene.
Stars: ✭ 23 (-91.9%)
Mutual labels:  unity3d-plugin
Nativewebsocket
🔌 WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP)
Stars: ✭ 273 (-3.87%)
Mutual labels:  unity3d-plugin
engine-plugin-unity3d
Unity3D plugin for iFun Engine
Stars: ✭ 15 (-94.72%)
Mutual labels:  unity3d-plugin
CategoryTool
Unity Editor tool to create Categories in the Hierarchy. The Categories work as dividers between GameObjects.
Stars: ✭ 47 (-83.45%)
Mutual labels:  unity3d-plugin
Savegamefree
Save Game Free is a free and simple but powerful solution for saving and loading game data in unity.
Stars: ✭ 279 (-1.76%)
Mutual labels:  unity3d-plugin
Merino
Merino is a narrative design tool that lets you write Yarn scripts inside the Unity Editor
Stars: ✭ 275 (-3.17%)
Mutual labels:  unity3d-plugin
uTextureSendReceive
Unity network texture sender and receiver for video and frame streaming
Stars: ✭ 111 (-60.92%)
Mutual labels:  unity3d-plugin

Admob Unity Plugin

Admob Unity Plugin provides a way to integrate admob ads in Unity3D Game and u3d app. You can use it for Unity iOS and Android App with the same c# or js code.

Admob Unity3d Plugin Readme Contents

  1. Admob Unity Plugin Description
  2. Unity Admob Plugin Features
  3. Downloads Admob Unity Plugin
  4. Installation Admob Unity
  5. Unity Plugin Wiki and Documentation
  6. Quick Start
  7. Unity Admob Demo Usage
  8. Important Tips
  9. Screenshots
  10. License

Admob Unity Plugin Description

The Google Mobile Ads SDK is the latest generation in Google mobile advertising featuring refined ad formats and streamlined APIs for access to mobile ad networks and advertising solutions. The SDK enables Unity mobile app developers to maximize their monetization in native mobile apps.

This repository contains the source code for the Google Mobile Ads Unity plugin. This plugin enables Unity developers to easily serve Google Mobile Ads on Android and iOS apps without having to write Java or Objective-C code. The plugin provides a C# interface for requesting ads that is used by C# scripts in your Unity project.

Unity Admob Plugin Features

Platforms supported in one plugin :

  • [x] Android, via SDK v18.3.0 (part of Google Play service platform)
  • [x] iOS, via SDK v7.53
  • [x] Support all native events
  • [x] AdRequest targeting methods,such as children target,test mode
  • [x] Not need change Android package name
  • [x] Very simple API
  • [x] Support non personalize ad

Ad Types:

  • [x] Banner(All Banner Type and Custom banner sizes)
  • [x] Interstitial (text, picture, video)
  • [x] Rewarded Video
  • [x] Advanced Native Ad

Downloads Admob Unity Plugin

AdmobPluginRes/GoogleMobileAds.framework and admob_unity_plugin.unitypackage is reqired
Download those files from Admob Unity3d Plugin Project Home https://github.com/unity-plugins/Unity-Admob
or Download all the Unity admob plugin project https://github.com/unity-plugins/Unity-Admob/archive/master.zip

Installation Admob Unity

  1. Open your project in the Unity editor.
  2. Navigate to Assets -> Import Package -> Custom Package.
  3. Select the admob_unity_plugin.unitypackage file.
  4. Import all of the files except admobdemo.cs(a example script) by selecting Import. Make sure to check for any conflicts with files.

You can install by download and copy files in folder Plugins to your Unity3d project directly,

Unity Plugin Wiki and Documentation

Quick Start

Edit AndroidManifest.xml and config Admob APP ID

This configuration is reqired by admob from version 17.0,APP will crash if not config .Add a meta-data tag in application and set value to your admob appid

 <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="ca-app-pub-xxxxxxxxxxxxxxxxxx~xxxxxxxxxxxx"/>

Sample code

  <application  android:theme="@style/UnityThemeSelector" 
   android:icon="@drawable/app_icon" 
   android:label="@string/app_name" >
	       <activity
	    android:name="com.unity3d.player.UnityPlayerActivity"
	    android:label="@string/app_name" >
	    <intent-filter>
	    <action android:name="android.intent.action.MAIN" />
	    <category android:name="android.intent.category.LAUNCHER" />
	    </intent-filter>
	    </activity>
	    <meta-data
	    android:name="com.google.android.gms.ads.APPLICATION_ID"
	    android:value="ca-app-pub-3940256099942544~3347511713"/>
  </application>

Edit Info.plist ,add appid

<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxxxxxxxxx~xxxxxxxxxxxxxx</string>

Config exported Xcode project ,Build Settings->Other Linker Flags ,add flag -ObjC ScreenShot

1.Init Admob Unity Plugin

Create A C# script ,drag the script to a object on scene , add the follow code in the script file

using admob;
Admob.Instance().initSDK(new AdProperties());//admob id configed in meta,not support in code any more

You can set admob properties as follow ,you need set properties you want to set

    AdProperties adProperties = new AdProperties();
    adProperties.isTesting(true);//true for test ads
    adProperties.isAppMuted(true);
    adProperties.isUnderAgeOfConsent(false);
    adProperties.appVolume(100);
    adProperties.maxAdContentRating(AdProperties.maxAdContentRating_G);
    string[] keywords = { "key1", "key2", "key3" };
    adProperties.keyworks(keywords);

2.Add Admob Banner in Unity App

Here is the minimal code needed to show admob banner.

Admob.Instance().showBannerRelative("your admob banner unit id",AdSize.BANNER, AdPosition.BOTTOM_CENTER, 0);

or you can create another banner by set banner name

Admob.Instance().showBannerAbsolute("ca-app-pub-3940256099942544/6300978111",AdSize.BANNER, 20, 220,"mybanner");

The AdPosition class specifies where to place the banner. AdSize specifies witch size banner to show

3.Remove Banner

By default, banners are visible. To hide a banner, call:

Admob.Instance().removeBanner();

4.How to integrate Interstitial into Unity 3d app?

Here is the minimal code to create an interstitial.

Admob.Instance().loadInterstitial("Your admob interstitial unit id"); 

Unlike banners, interstitials need to be explicitly shown. At an appropriate stopping point in your app, check that the interstitail is ready before showing it:

if (Admob.Instance().isInterstitialReady()) {
  Admob.Instance().showInterstitial();
}

5.Custom Admob Banner Ad Sizes

In addition to constants on AdSize, you can also create a custom size:

//Create a 250x250 banner.
AdSize adSize = new AdSize(250, 250);
Admob.Instance().showBannerAbsolute("Your admob banner id",adSize,0,30,"bannerName");

6.How to integrate Admob Rewarded Video to Unity3d app?

Here is the minimal code to create an admob video.

Admob.Instance().loadRewardedVideo("ca-app-pub-3940256099942544/1712485313"); 

Simular with interstitial,video need to be explicitly shown at an appropriate stopping point in your app, check that the video is ready before showing it:

if (Admob.Instance().isRewardedVideoReady()) {
  Admob.Instance().showRewardedVideo();
}

7.Show Admob Native Advanced Ad in IOS and Android App

Here is the minimal code needed to show admob banner. This is implemented with Admob Native Ads Advanced (Unified)

Admob.Instance().showNativeBannerRelative("Your native banner id",new AdSize(360,100), AdPosition.BOTTOM_CENTER);

8.Ad Events

Both Banner and Interstitial contain the same ad events that you can register for. Here we'll demonstrate setting ad events on a interstitial,and show interstitial when load success:

Admob.Instance().interstitialEventHandler += onInterstitialEvent;
void onInterstitialEvent(string eventName, string msg)
{
    Debug.Log("handler onAdmobEvent---" + eventName + "   " + msg);
    if (eventName == AdmobEvent.onAdLoaded)
    {
        Admob.Instance().showInterstitial();
    }
}

You only need to register for the events you care about.

Unity Admob Demo Usage

  1. import AdmobUnityPlugin.unitypackage to your Unity project

  2. copy admobdemo.cs from AdmobPluginRes to your unity project/assets dic

  3. attach admobdemo.cs to the main camera

  4. edit admob id in admobdemo.cs

  5. build and run this in your device

  6. add -ObjC flag in xcode Other Linker Flags 7 add meta app key in Xcode Info.plist

    GADApplicationIdentifier ca-app-pub-xxxxxxxxxxxxxxxxxx~xxxxxxxxxx

Important Tips

  1. If you not config AndroidManifest.xml,app will crash
  2. If you not add -ObjC flag App will crash
  3. If you not add GADApplicationIdentifier in Info.plist ,App will crash
  4. Attach admob to Object on scene,init admob before call admob fun

Screenshots

ScreenShot

License

Apache 2.0 License

Change Log

1.Update admob sdk,support admob 18.3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].