Adverty

Documentation

    Release notes

    4.2.

    • ● Added support for VAST campaigns (unit allowing animations will ask for VAST aswell)
    • ● Overall performance and memory usage improvements

    Known Issues

    In Unity 2019.2, Unity and Native graphic device is not synced from the start generating an error log OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM. This does not affect the functionality and will only be logged once. 

    In Unity 2021.1 to 2022.1 building Android apps using Mono is causing runtime issues. We recommend IL2CPP or to update the Unity version to resolve the issue.

    In some unity versions below 2021.3.37f1, 2022.3.24f1, 2023.2.18f1 Unity is loading some libraries faulty which we use leading to occasional crashes please update to the mentioned versions or above

    Using URP v.12 and above requires small modifications to AdSpriteLitShader. See comments in the file for guidance.

    Requirements

    • ● Officially released Unity versions 2019 or later.
    • ● “32-bit Display Buffer” set to true, under “Resolution and Presentation” 
    • ● Compute shader compatible devices
      • Windows PC with Directx 11 or 12 graphics API and Shader Model 5.0 GPU
      • macOS and iOS using Metal graphics API
      • Modern Open GL platforms (Open GL 4.3 for windows and Open GL ES 3.1 for Android)
      • Vulkan for Android
      • Preview Linux 
      • Android 5.0 together with above requirements
      • iOS 8 together with above requirements
    • ● Scripting backend .Net 4.0

    Deprecation Strategy

    The Adverty API have with SDK 4.0 made some changes to public API and we have decided to keep a policy. When we make a deprecation the api will be removed at earliest 2 minor/major releases later..

    ProGuard Rules

    If you are using ProGuard for Android there is a set of rules that needs to be used to maintain the AdvertySDK in the building process.

    -keep class com.unity3d.player.**{ *; }
        -keep class com.adverty.**{ *; }

    Setup SDK

    In this section we will describe in deepth how to set up the Adverty SDK for your app. If you are looking for a quick guide take a look at 7 easy steps to get started

    Import the SDK

    ● Download the unity package from Unity Assetstore or the SDK repository and import it to your project. If your facing issues while updating remove Adverty folder and reimport the package.

    Setup the SDK

    ■ Click the dropdown Tools > Adverty > Settings and select the platform for your application (AR, VR or Mobile). Then add the API key generated in the portal. For testing integration you should use the Sandbox mode which is enabled with a checkbox.
     Then call the AdvertySDK.Init with parameters to start an Adverty session.

    ■ NOTE: To start earning revenue, remember to publish your application in the portal at adverty.com to set the application to “Live”. Apps which is not set to live status will fail to sign-in to our service without sandbox enabled.

    Set correct MainCamera

    ■ Set the correct Main Camera through AdvertySettings.SetMainCamera(Camera camera). AdvertySDK incorporates camera and rendering calculations on the main camera. Use this method to specify the main game camera to the AdvertySDK. This is important to ensure revenue for your ad units.

    Activate AdvertySDK

    ■ To activate the AdvertySDK you need to call AdvertySDK.Init. Calling Init without any of the optional parameters will use the current configuration set on AdvertySettings and trigger an SDK sign in. If any of the data change you should call Adverty.Init again to have an Adverty session with the updated parameters. If you want more control of the data used to initialize your session you can use more parameters to the AdvertySDK.Init described further down

    Example with only required parameters:

    public class ActivateAdvertyExampleClass : MonoBehaviour
        {
            void Start()
            {
                UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown);
                Adverty.AdvertySDK.Init(userData);
    
                Adverty.AdvertySettings.SetMainCamera(YourGameCamera);
            }
        }
        

    Setup AdUnits

    ● Add an ad unit to your scene

    ○ Locate either the InPlayUnit.prefab or any of the InMenuUnit.prefab’s in Adverty/Prefabs/ in the project window hierarchy.

    ○ Drag the prefab into the scene and position it as you do with any regular game objects in Unity. Menuunit needs to be placed on a Canvas

    ○ Snap the InPlayUnit to a surface.

    • ■ The ad unit can be attached to any surface by activating the “Snap to surface” checkbox in the top left corner of the preview window. When the ad unit is selected, click on a desired surface to attach the ad unit to it. This will adjust the position and rotation of the ad unit to match the surface.

    Surface

    ● Ad unit settings

    The Adverty units can utilize different renders to fit all your needs. The supported unity renders are Mesh, Sprite and UI. These renders can be used for both InMenu and InPlay units. This is a setting on the Unit component

    It is possible to change the mesh used for units using the MeshRender, however it has to be an Adverty generated mesh. The package includes a standard and flat UnitMesh (Adverty/Resources/Meshes). It is also possible to generate and store new meshes with different bending properties. Click on “Create Mesh” in the unit editor to access this functionality. The new mesh is bendable in one axis at the time (X-axis or Y-axis) and in either direction (concave or convex). Click the “Save mesh” button to store this mesh somewhere in the project folder. This generated mesh is reusable on any ad unit.

    Convex_x

    Enable Adverty Debug

    ■ Go to Tools > Adverty > Debug and check “Enable Adverty Logs” to enable debug logs from the AdvertySDK. Select the wanted Verbosity of logs. It is recomended to always show warnings and errors to help with trouble shooting of the SDK.

    When you create a new app through the Portal the app will be not be eligable for paid campaigns. You should test the integration using Sandboxmode (Checkbox at Tools->Adverty->Settings). This means that you will retrieve sample campaigns in your app and inside the Unity Editor.

    Enable Sandbox Mode

    Enable sandbox mode by checking the checkbox at Adverty -> Settings “Sandbox Mode”. It is enabling you to enable sandbox in the editor and keeping your production key live. Sandbox setting means that you will retrieve sample campaigns in your app inside the Unity Editor and on devices. With Sandbox enabled you will not be able to earn any revenue so make sure to untick the checkbox and have your app set to live in the Portal before publishing your app.

    Test your ad units

    ○ The ImpViz™-component is a real-time impression indicator that shows when ad units placed in the scene generates impressions. This helps you optimize the monetization potential of each ad unit. Remember to remove the ImpViz-component before publishing you application.

    ○ Locate the impVizComponent in the Adverty.dll plugin and attach it to the adUnit gameObject that you want to test. If you want to test all adUnits in the scene go to Adverty->Debug and click “Add ImpViz component to all units”.

    ○ When playing the application in Unity the ad units with impViz component attached will tint with impression color when the first ad impression is registered and tint with bounce back color each time it registers an impression after that. This gives a good understanding of how the ad unit should be designed and placed in the scene to generate impressions.

    Observe that ImpViz is availible for all units but MenuUnit will only be triggered on iOS devices. ViewedImpression event is availible for both unit types but Menuunit will only trigger impressions on iOS devices (Support for other platforms will be included in future releases).

    Ad Unit Types

    ● In-Play™: Non-clickable objects that can be placed on the scenes to help you monetize the gameplay.

    ● In-Menu™: Clickable objects that can seamlessly blend in with menus. By default clicks open up in external app of the users choice (Default apps)

    In-Play™.GameUnit.prefab

    3 settings will affect the unit behavior:

    ● Render Type: Changing Render type to fit how your game is rendered. All Adverty units can have Mesh, Sprite or UI Renderer

    ● Shader Type: Two shader types can be used. Unlit type will not be affected by lighting and will show the ad unit with the campaigns “true” colors. Lit type will be affected by lighting in the scene.

    ● Allow Animation: If the unit can display both animated and static campaigns.

    General advices

    Adverty requires internet to load ads during runtime and there is always a possibility an ad is not delivered. To give the user an as enjoyable experience as possible we suggest the following actions.

    Apply your own texture

    You can apply your own texture to a unit. This makes it so that if the AdUnit is not receiving an ad your desired texture will be shown. If an ad is delivered your texture will be replaced by the ad. The ratio of the adUnits are 1.2:1, 1:2 or 16:9 for VR and AR and 1.2:1, 1:2 or 3.88:1 for Mobile. To do this you simply add your texture to the Unit in unity editor or assign it to the material through script.

    void Start()
        {
            unit.GetComponent<Renderer>().material.mainTexture = yourTexture;
        }

    Disable MeshRenderer

    You can disable the MeshRenderer on the Unit-prefab. When an ad is delivered the MeshRenderer is activated. This enables the AdUnit not to render in the game until an actual ad is delivered. You can do this either via the inspector or via code.

    void Start()
        {
            unit.GetComponent<MeshRenderer>().enabled = false;
        }

    Hide UI adplacement

    You can hide the Unit-prefab prior to activation by checking the checkbox Hide Adplacement. When an ad is delivered the placement will show. This enables the AdUnit not to render in the game until an actual ad is delivered. .

    Scripting API

    AdvertySDK

    void AdvertySDK.Init(UserData userData)

    To activate the AdvertySDK you need to call AdvertySDK.Init. Calling Init without any of the optional parameters will use the current configuration set on AdvertySettings and trigger an SDK sign in. If any of the data change you should call Adverty.Init again to have an Adverty session with the updated parameters. If you want more control of the data used to initialize your session you can use more parameters to the AdvertySDK.Init described further down

    Example with only required parameters:

    public class ActivateAdvertyExampleClass : MonoBehaviour
        {
            void Start()
            {
                UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown);
                Adverty.AdvertySDK.Init(userData);
    
                Adverty.AdvertySettings.SetMainCamera(YourGameCamera);
            }
        }
        

    void AdvertySDK.Init(string apiKey, AdvertySettings.Mode platform, bool restrictUserData, UserData userData)

    Initialize Adverty SDK using parameters. with this init call you control which API-key and platform that is used to set up the AdvertySession. You can achieve the same result by the simplier Init-call by assigning correct values to the parameters of AdvertySettings. The more precise UserData you supply to the the SDK the more you will earn. the additional data that can be added is AgeData (user age) and TCF2.0 consents. Adverty’s vendor id is 822 in TCF 2.0

    Example 2 with optional parameters:

    public class ActivateAdvertyExampleClass : MonoBehaviour
        {
            void Start()
            {
                string apiKey = YOUR_API_KEY;
                Adverty.AdvertySettings.Mode platform =
                Adverty.AdvertySettings.Mode.Mobile;
                bool restrictPersonalData = false;
                UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown, 35 /* User age */, "Consent strings from IAB Transparency and Consent Framework");
                Adverty.AdvertySDK.Init(apiKey, platform, restrictPersonalData, userData);
    
                Adverty.AdvertySettings.SetMainCamera(YourGameCamera);
    
            }
        }

    The easiest way to add your TCF 2.0 string is to create UserData with the constructor UserData(string tcfstring).

    
                    UserData userData = new UserData("Consent strings from IAB Transparency and Consent Framework");
            

    void AdvertySDK.Init(string apiKey, AdvertySettings.Mode platform, bool restrictUserData, UserData userData)

    Initialize Adverty SDK using parameters. with this init call you control which API-key and platform that is used to set up the AdvertySession. You can achieve the same result by the simplier Init-call by assigning correct values to the parameters of AdvertySettings. The more precise UserData you supply to the the SDK the more you will earn. the additional data that can be added is AgeData (user age) and TCF2.0 consents. Adverty’s vendor id is 822 in TCF 2.0

    Example 2 with optional parameters:

    public class ActivateAdvertyExampleClass : MonoBehaviour
        {
            void Start()
            {
                string apiKey = YOUR_API_KEY;
                Adverty.AdvertySettings.Mode platform =
                Adverty.AdvertySettings.Mode.Mobile;
                bool restrictPersonalData = false;
                UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown, 35 /* User age */, "Consent strings from IAB Transparency and Consent Framework");
                Adverty.AdvertySDK.Init(apiKey, platform, restrictPersonalData, userData);
    
                Adverty.AdvertySettings.SetMainCamera(YourGameCamera);
    
            }
        }

    void AdvertySDK.Terminate()

    Terminates the current Adverty session, if any exists.

    Example:

    public class DeactivateAdvertyExampleClass: MonoBehaviour
            {
                void Start()
                {
                    Adverty.AdvertySDK.Terminate();
                }
        }

    AdvertySettings

    AdvertySettings is keeping track of all information regarding how to set up an AdvertySession. When calling AdvertySDK.Init the SDK is updating AdvertySettings if optional paramaters was sent in and then using AdvertSettings to create an AdvertySession

    void AdvertySettings.SetAPIKey(string key)

    Sets the API-key property in AdvertySettings. This dosen’t trigger a new AdvertySDK.Init by itself, so make sure to call AdvertySDK.Init after changing API-key

    Example:

    public class ChangeAdvertyAPIKeyExampleClass : MonoBehaviour
                {
                    void Start()
                    {
                        AdvertySettings.SetAPIKey("YOUR_API_KEY")
    
                        UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown);
                        Adverty.AdvertySDK.Init(userData);
                    }
                }
    
                

    void AdvertySettings.SetMainCamera(Camera camera)

    Set the correct Main Camera through AdvertySettings.SetMainCamera(Camera camera). AdvertySDK incorporates camera and rendering calculations on the main camera. Use this method to specify the main game camera to the AdvertySDK. This is important to ensure revenue for your ad units.

    Example:

    public class OverrideAdvertyCameraExample : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdvertySettings.SetMainCamera(Camera.main);
                    }
                }

    void AdvertySettings.ClearAPIKey()

    Clears the API-key from AdvertySettings

    bool AdvertySettings.ValidateAPIKey(string key)

    Validates an API-key. Keys automaticly gets validated when you call AdvertySDK.Init or fill it in the AdvertyMenu (Tools->Adverty->Settings)

    UserData AdvertySettings.UserData

    Set and Get the UserData property. When you update it you need to call AdvertySDK.Init to create a new session and thus applying the change. Provide user data to the AdvertySDK to improve targeting and eCPM for the ads you can modify it in AdvertySettings.UserData.

    Example:

    public class ModifyUserDataExample : MonoBehaviour
                {
                    void Start()
                    {
                        UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown);
                    }
                }
                
    public class SetTCFString : MonoBehaviour
                    {
                        void Start()
                        {
                            UserData userData = new UserData('your tcf2.0string');
                        }
                    }
                    

    UserData constructor also includes an optional parameters for Consent strings from IAB Transparency and Consent Framework 2.0 and user age.

    Example:

    public class UserDataWithConsentStringExample : MonoBehaviour
                {
                    void Start()
                    {
                        UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown, "Consent strings from IAB Transparency and Consent Framework");
                    }
                }
                
    public class UserDataWithUserAgeAndConsentStringExample : MonoBehaviour
            {
                void Start()
                {
                    AgeData userAge = new AgeData(35);
                    UserData userData = new UserData(AgeSegment.Unknown, Gender.Unknown, userAge, "Consent strings from IAB Transparency and Consent Framework");
                }
            }
            

    bool AdvertySettings.RestrictUserData

    If you want to block the AdvertySDK from collecting personal data from the user you can set restrictUserData to true and then call Adverty.Init to apply the changes. This will reduce the potential demand and reduce the overall revenue.

    Example:

    public class RestrictUserDataExample : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdvertySettings.RestrictUserData = true;
                    }
                }
                

    string AdvertySettings.APIKey

    Set and Get the API-key of AdvertySettings.

    Mode AdvertySettings.Platform

    Set and Get the platform of AdvertySettings. Call AdvertySDK.Init to apply the changes. If you have multiple modes in a game. For example a 360 view and a VR mode, it is possible to switch the platform of the Adverty SDK.

    Example:

    public class ChangeModeExample : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdvertySettings.Platform = Mode.Mobile; //Mode.AR, Mode.VR
                    }
                }
                

    AdvertyEvents

    AdvertyEvents is a collection of events where you can subscribe on certain events to do things dependeing on the flow of Adverty SDK.

    event Action AdvertyEvents.AdvertySessionActivated

    AdvertySessionActivated fires when an AdvertySession is created successfully.  Best practice should be to start initiating units when you have an activated session

    event Action AdvertyEvents.AdvertySessionActivationFailed

    FailedAdvertySessionActivation fires if an Adverty Session fails to activate.

    event Action AdvertyEvents.AdvertySessionTerminated

    Event fires when an Adverty session is terminated

    event Action <BaseUnit> AdvertyEvents.AdDelivered

    Every ad unit will request ads and when a Unit has got an ad AdDelivered will execute this will be done before the units activates and it can still fail to activate due to for example an issue in the ad itself. It returns a BaseUnit which is the parent to the InPlayUnit and InMenuUnit.

    In contrast to the other Unit events this event is about the ads and gets triggered every time a new ad is loaded for a unit, even if the unit itself don’t deactivate or active to show the ad.

    Example:

    public class AdDeliveredExampleClass : MonoBehaviour
                        void Start()
                        {
                            Adverty.AdvertyEvents.AdDelivered += AdDelivered;
                        }
    
                        private void AdDelivered(Adverty.BaseUnit  unit)
                        {
                            //ADD ACTION ON AD DELIVERED IF NEEDED
                        }
    
                    

    event Action <BaseUnit> AdvertyEvents.UnitActivated

    Every ad unit will request ads and UnitActivated will execute when the unit start to show ads. It returns a BaseUnit which is the parent to the InPlayUnit and InMenuUnit.

    This event will fire every time a unit goes from deactivated to active

    Example:

    public class UnitActivatedExampleClass : MonoBehaviour
                    void Start()
                    {
                        Adverty.AdvertyEvents.UnitActivated += UnitActivated;
                    }
    
                    private void UnitActivated(Adverty.BaseUnit  unit)
                    {
                        //ADD ACTION ON UNIT ACTIVATION IF NEEDED
                    }
    
                

    event Action <BaseUnit> AdvertyEvents.UnitActivationFailed

    Every ad unit will request an ad and if it don’t recieve an ad or fails to render it UnitActivationFailed will fire. It returns a BaseUnit which is the parent to the InPlayUnit and InMenuUnit.

    Example:

    public class UnitActivationFailedExampleClass : MonoBehaviour
                    void Start()
                    {
                        Adverty.AdvertyEvents.UnitActivationFailed += UnitActivationFailed;
                    }
    
                    private void UnitActivationFailed(Adverty.BaseUnit  unit)
                    {
                        //ADD ACTION ON UNIT ACTIVATION FAILED IF NEEDED
                    }
    
                

    event Action <BaseUnit> AdvertyEvents.UnitDeactivated

    When a unit gets deactivated UnitDeactivated will fire. This happens when a unit has been active and the lifespan of the ad reaches its end. Unit will keep the texture after this event but cannot be registered as viewed anymore. Unit will automaticly try to refresh and might get a new ad, otherwise UnitActivationFailed will get triggered. It will also get triggered when the AdvertySession has been terminated. It returns a BaseUnit which is the parent to the InPlayUnit and InMenuUnit

    Example:

    public class UnitDeactivatedExampleClass : MonoBehaviour
                    void Start()
                    {
                        Adverty.AdvertyEvents.UnitDeactivated += UnitDeactivated;
                    }
    
                    private void UnitDeactivated(Adverty.BaseUnit  unit)
                    {
                        //ADD ACTION ON UNIT DEACTIVATED IF NEEDED
                        //Example of action can be to hide unit or apply your own texture to it
                    }
    
                

    event Action <BaseUnit> AdvertyEvents.UnitViewed

    UnitViewed gets triggered when an ad is considered viewed by our patented viewability solution BrainImpression. This is crucial for increasing the value of your ads as advertisers pay more for ads where they have good viewability. It returns a BaseUnit which is the parent to the InPlayUnit and InMenuUnit.

    UnitViewed can be triggered several times per Unit since same unit can show more than one ad during the lifespan of the unit

    Example:

    public class UnitViewedExampleClass : MonoBehaviour
                    void Start()
                    {
                        Adverty.AdvertyEvents.UnitViewed += UnitViewed;
                    }
    
                    private void UnitViewed(Adverty.BaseUnit  unit)
                    {
                        //ADD ACTION ON UNITVIEWED IF NEEDED
                    }
    
                

    event Action <BaseUnit> AdvertyEvents.AdCompleted

    AdCompleted gets triggered when an ad is completed for the first time. This means that a MenuUnit has been interacted and that the fullpage webview has been shown. Event gets triggered when the user returns to your game. It returns a BaseUnit which is the parent to the InPlayUnit and InMenuUnit.

    AdCompleted can be triggered several times per InMenuUnit since same unit can show more than one ad during the lifespan of the unit

    Example:

    public class AdCompletedExampleClass : MonoBehaviour
                        void Start()
                        {
                            Adverty.AdvertyEvents.AdCompleted += AdCompleted;
                        }
    
                        private void AdCompleted(Adverty.BaseUnit  unit)
                        {
                            //ADD ACTION ON AD COMPLETED SUCH AS A REWARD
                        }
    
                    

    Deprecated event Action WebViewOpened

    Deprecated as external webview will be used at all times. Use Monobehavior’s OnApplicationPause to customize behaviour when user is leaving for click.

    Deprecated event Action WebViewClosed

    Deprecated as external webview will be used at all times. Use Monobehavior’s OnApplicationPause to customize behaviour when user is returning after click.

    Example:

    NOTE: If your rewards includes visuals and some in-game event, this should be executed on Monobehavior’s OnApplicationPause. However, the reward should be given on AdvertyEvents.AdCompleted. (Monobehavior’s OnApplicationPause can be triggered without AdCompleted being triggered. For example if the user decides to cancel the ad before it finished and close the ad overlay)

    NOTE 2: These campaigns uses a native functionality for Android/iOS to show fullscreen ad. That means it is not possible to test the full flow inside Unity Editor. This requires running on an Android/iOS device.

    Programmatic setup of adunits (UnitFactory)

    To instantiate units during runtime you can of course instantiate the InPlayUnit.prefab or InMenuUnit.prefab but you can also use the Adverty.AdUnit.UnitFactory class. 

    Create method of any of the factory will return a unit gameobject of the specific type, configuration with the optional parameters such as: Mesh, Texture, Sprite and GameObject name.

    UnitFactory
    InPlayUnit example without optional parameters:

    public class InPlayUnitInstantiateExampleClass : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdUnit.InPlayUnitConfiguration config = new Adverty.AdUnit.InPlayUnitConfiguration();
                        Adverty.AdUnit.ViewData viewData = new Adverty.AdUnit.ViewData();
                        viewData.Size = 1.0f;
                        viewData.Ratio = Adverty.AdUnit.UnitRatio.Box;
                        config.ViewData = viewData;
                        GameObject unit = Adverty.AdUnit.UnitFactory.Create(config);
                    }
                }

    InPlayUnit example with optional parameters:

    public class InPlayUnitInstantiateExampleClass : MonoBehaviour
                {
                    public Mesh bentAdvertyMesh;
                    void Start()
                    {
                        Adverty.AdUnit.InPlayUnitConfiguration config = new Adverty.AdUnit.InPlayUnitConfiguration();
                        Adverty.AdUnit.ViewData viewData = new Adverty.AdUnit.ViewData();
                        viewData.Size = 1.0f;
                        viewData.Ratio = Adverty.AdUnit.UnitRatio.Box;
                        config.ViewData = viewData;
                        GameObject unit = Adverty.AdUnit.UnitFactory.Create(config, bentAdvertyMesh, "CustomName");
                    }
                }

    InMenuUnit example with optional parameters:

    public class InMenuUnitInstantiateExampleClass : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdUnit.InMenuUnitConfiguration menuConfig = new Adverty.AdUnit.InMenuUnitConfiguration();
                        Adverty.AdUnit.ViewData viewData = new Adverty.AdUnit.ViewData();
                        viewData.Size = 1.0f;
                        viewData.Ratio = Adverty.AdUnit.UnitRatio.Box;
                        viewData.MatchWidthOrHeight = Adverty.AdUnit.WidthHeight.Width;
                        menuConfig.ViewData = viewData;
                        GameObject unit = Adverty.AdUnit.UnitFactory.Create(menuConfig);
                    }
                }

    InMenuUnit example with optional parameters:

    public class InMenuUnitInstantiateExampleClass : MonoBehaviour
                {
                    public Texture2D defaultTexture;
                    void Start()
                    {
                        Adverty.AdUnit.InMenuUnitConfiguration menuConfig = new Adverty.AdUnit.InMenuUnitConfiguration();
                        Adverty.AdUnit.ViewData viewData = new Adverty.AdUnit.ViewData();
                        viewData.Size = 1.0f;
                        viewData.Ratio = Adverty.AdUnit.UnitRatio.Box;
                        viewData.MatchWidthOrHeight = Adverty.AdUnit.WidthHeight.Width;
                        menuConfig.ViewData = viewData;
                        GameObject unit = Adverty.AdUnit.UnitFactory.Create(menuConfig, defaultTexture, "CustomName");
                    }
                }

    The defaultTexture will be shown on adunit before an ad is loaded or if the unit is not filled with an ad for some reasons.

    InPlayUnit example with target Sprite Renderer:

    public class SpriteUnitInstantiateExampleClass : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdUnit.InPlayUnitConfiguration config = new Adverty.AdUnit.InPlayUnitConfiguration(Adverty.AdUnit.RenderType.Sprite);
                        Adverty.AdUnit.ViewData viewData = new Adverty.AdUnit.ViewData();
                        viewData.Size = 1.0f;
                        viewData.Ratio = Adverty.AdUnit.UnitRatio.Box;
                        viewData.MatchWidthOrHeight = Adverty.AdUnit.WidthHeight.Width;
                        config.ViewData = viewData;
                        GameObject unit = Adverty.AdUnit.UnitFactory.Create(config);
                    }
                }

    Factory will create InPlay unit based on Sprite Renderer.

    InMenuUnit example with target Mesh Renderer:

    public class InMenuUnitMeshInstantiateExampleClass : MonoBehaviour
                {
                    void Start()
                    {
                        Adverty.AdUnit.InMenuUnitConfigutration config = new Adverty.AdUnit.InMenuUnitConfigutration(Adverty.AdUnit.RenderType.Mesh);
                        Adverty.AdUnit.ViewData viewData = new Adverty.AdUnit.ViewData();
                        viewData.Size = 1.0f;
                        viewData.Ratio = Adverty.AdUnit.UnitRatio.Box;
                        viewData.MatchWidthOrHeight = Adverty.AdUnit.WidthHeight.Width;
                        config.ViewData = viewData;
                        GameObject unit = Adverty.AdUnit.UnitFactory.Create(config);
                    }
                }

    Factory will create InMenu unit based on Mesh Renderer.

    • iab
    • iab
    • Tag
    • IAB Europe