Banner View - Blueprint Examples

This section contains examples on how to use Banner Views with Blueprints.

Creating a Banner View

To use a Banner view, we first have to create one. You can create a Banner View with the Create Banner View Blueprint node.

It's important to store the Banner View in a variable to prevent it from being garbage collected.

Make sure you connect the Created pin and not the default execution pin.

Loading an Ad

Now that the Banner is initialized, it's time to load an ad that will be then shown to the user.
To load an ad, call the Load Ad for Banner View node.

If you plan to show a Banner View during a precise time as for level transition, you should load the ad before so the ad is ready when you want to show it.

Showing the Banner

To show the Banner View, simply use the Show Banner View node.

Moving the Banner

There are two ways to move the banner.

To move the banner to a predefined position, you can use the following code:

Or to move to a custom X/Y position, we can pass directly the X and Y coordinates:

Error Handling

Creating, loading and displaying a banner view might fail with different reasons as network error, fill error, configuration error, and other less common errors. For this reason, it is good practice to cleanly handle these possible errors.

First, let's create a simple error handler. It prints the error and tries to show the banner view again after a fixed delay.

This is a very simple error handler. In your application, you might want to modify it to typically have an incremental delay before retrying in case of a network error, stop asking for ads for a longer moment if the server does not have any ads for you, etc.

We can now modify the code used to create and show the banner view to use our handler in case of error:

And that's it, if you run this code in a non-shipping build, any error will be printed and a new attempt to create, load and show the banner view will start.

Ad Blocker detected. The documentation might not work properly.
Some pages or images might be blocked if your ad blocker uses URL-based blocking as it contains the word "AdMob".
This documentation doesn't show any ads whatsoever.

The documentation is being reworked.

Page content is subject to change. You might need to force refresh the page to see changes.