This article is our first with a true tech bent. Written by one of our mobile developers, Loïc Giron Dit Metaz, it delves into what Unity has brought to the tech world as well as how Smart AdServer went about building a bridge between Unity and its mobile SDK.

What’s Unity?

Unity, a game engine developed by Unity Technologies, is used to develop video games that can be released on multiple platforms including computers, consoles, and mobile phones. In addition to gaming, Unity is also an engine for working with the most popular VR platforms – Oculus Rift and Google Cardboard.

The framework can help game developers by handling the 3d rendering, sound, and physics of their video game, but Unity is also helpful because developers only have to code once, and with a few modifications, can be deployed on all screens.

Unity is advantageous for publishers and advertisers. Unity games reach a wider audience than traditional ones. They’re providing more inventory for publishers and allow advertisers to target various user profiles within the same app. For example, hard-core desktop gamers are likely to have different interests than casual gamers playing on smartphones.

The game engine was launched in 2005 and has gained a lot of momentum thanks to the rise of mobile gaming. The engine also became popular due to its low price subscription business model which is well-suited for independent developers. In 2005, Unity announced the fifth major version of their engine and added a free licensing option across all platforms for independent developers earning less than $100k. This helped them gain even more developers, and some competitive platforms were even forced to adopt their pricing model. This new licensing scheme was a smart move because it allows small studios and casual developers to create entire games without taking financial risks (even though they’ll still have to move to a paid license if their game is successful).

Unity has now more than 5 million registered developers that have published more than 200k games including. There are more than 1 billion mobile devices running at least one app made with Unity. It’s now widely used for small, but successful independent games like Kerbal Space Program and the hit Pokemon GO. Even Super Mario Run, the Nintendo game for mobile phones, is using Unity!

Kerbal Space Program

Pokemon GO

What it Takes to Build a Unity Bridge

If you develop a game using Unity, you’ll want to monetize it through advertising. And even if your favorite ad SDK does not exist for Unity, you can still leverage it to display ads.

As long as your game is launched on the right device, Unity can run native code in your game from a given platform such as Android or iOS using a mechanism called Native Plugins. For example, you can run iOS native code on iOS devices and deactivate it when you are running the same app on MacOS. This also means that you can use your preferred ad SDK on Unity with a bit of boilerplate code.

This approach requires that you write a wrapper for each SDK you intend to use, and for each platform. You’ll need to:

-Write C# code that interacts with Java to target Android

-Write C# code that interacts with C functions and that allocates ObjC objects to target iOS

This kind of implementation might seem complex because it involves several different languages, but it requires less code than developing a full Unity SDK from scratch and it will allow the app to display the maximum of formats available.

The downside of using Native Plugins is that you will only have ads on platforms handled by your native SDK. Plus, complex integration (like an ad displayed as a texture) isn’t possible, so your ads will only be displayed on top of your game.

Smart AdServer iOS SDK displaying a banner in a Unity game

Creating an actual native plugin for Unity can be a little bit tedious since the documentation is not extremely developed and since the process is different for every platform you want to support. If you don’t know how to start, take a look at our integration sample that displays ads on Android & iOS using our mobile SDK.

This sample is distributed under the MIT License so you can use it in your project! To start, simply copy the Assets/Plugins directory into your project and instantiate a BannerView or an InterstitialView object as shown in the GameController class.

A Unity bridge is just one advantage that Smart AdServer customers have. Take a look our latest newsletter for all the other new features in the latest version of our mobile SDK. We have tons of formats that will boost app monetization!

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it. For more information about the cookies we use, we invite you to read our Corporate Privacy Policy.OkPrivacy policy