Introduction to ctalyst® Unreal Engine UE4 Product Placements
Before beginning this tutorial, be sure you have watched the tutorial on how to install the ctalyst® plugin and the tutorial on how to create Dynamic and Static ads.
You can find the tutorials here:
Downloading and Importing the Free 3D Models
Begin by downloading a 3D asset from ctalyst’s product placement catalog. Login to your publisher account, click on the Product Placement Quick button, and then click View Catalog.
For this tutorial, we will use the Vending Machine. You can use any object from the catalog.
Navigate to the Vending Machine page and click Download All. Extract the zip file. You will find the default “ctalyst” texture template in Photoshop format. You can use this template to create your own default texture that matches the genuine look and feel of your game.
It’s important to make sure you have already added this product placement to your game’s ad inventory. You can add this at any time prior to publishing your game by editing your game’s registration information on the ctalyst site.
Adding the 3D inventory to your game’s registration information validates it and will add it to the Game ID on the API/Tokens page. You will need the 3D object code later in this tutorial.
Adding the Product Placement to Your UE4 Project
Open your game project in Unreal Engine.
In this tutorial, we’ll be demonstrating with a blank Level and the plugin installed. However, you can import and use ctalyst at any point during your game development cycle.
Import the 3D model and your default texture into your Unreal project.
Place the imported assets into one folder. In this tutorial, we’ve named the folder Product Placements/Vending Machine.
Once imported you will see the FBX, blueprint and other assets within the directory you created.
Edit the material for the imported Product Placement object and re-name it to VendingMachine Material.
Open up the material into the Material Editor and delete the node labeled None.
Right-click on empty region of the graph and select “TextureSample”. Convert the “TextureSample” to a parameter by right-clicking and choosing the “Convert to Parameter” option.
Make sure to rename the TextureSample module to “ctalystTexture” or the ad serving will not work. Be aware this name is case sensitive.
Connect the first connection node of the ctalystTexture module to the “Base Color” Connection node of the ” VendingMachineMaterial ” module.
Apply your default texture. This is the texture you would like your gamers to see if an ad cannot be served or if the gamer does not have an internet or data connection.
From the Details Window navigate to the Material Expression Texture Base tab and select your texture.
Save your changes and exit the material editor.
Open the Blueprint for the Vending Machine and under the components window select Static Mesh Component and add the box collider to it. Adjust the size of the box collider to fit your object.
We can now add the ctalyst custom collision method to the Vending Machine’s blueprint’s box collider to execute when a collision is detected.
Navigate to Event Graph Tab, and add a method to the Event ActorBeginOverlap.
Right-click on the graph and add ctalyst’s custom function titled Actors Overlapped Event.
Connect the Event ActorBeginOverlap module’s execution node to the Actors Overlapped Event execution node.
The Actors Overlapped Event mothod has two parameters. They are named Overlapping Actor and Overlapped Actor.
Select Other Actor under Event ActorBeginOverlapped and connect it to the Overlapping Actor parameter of the function.
Right-click on an empty space in the graph editor and select Get a Reference to self and connect it to the Overlapped Actor parameter.
Creating The In-Game Reward
We must now add the in-game reward.
Interactive ads, such as product placements, must always offer the player an in-game reward of immediate value, in addition to a real-world reward delivered in the coupon menu.
If you have not created a reward function, you will need to so first. If you need help, you can contact the ctalyst team at any time.
From the list select the reward function that you’ve created.
In this example, we are using a print statement to validate that the reward is being delivered.
Compile, save and exit the event graph.
Setting Up The Ad Serving on The Product Placement
Drag and drop the Vending Machine’s blueprint into the scene.
Now add the Vending machines blueprint to the ctalystSDK, by selecting the ctalystSDK under the World Outliner window.
Navigate to the Details window, add an object to the Ad Objects List by clicking the plus sign.
Set the actor option to the interactive Vending Machine’s blueprint.
Set the adType to Product Placement.
Set the AdCode to 3D Object.
Update the Product Placement ID to the Product Placement ID assigned on the API/Tokens page of your developer account.
Your selection for Coupon type is based on how you’ve set up your reward menu system.
Priority is a grouping that determines the ad serving order. The lower the number, the higher the priority.
You can assign multiple objects to the same priority group. This is a great feature that allows you to design the prioritization of ad displays based on where a player is located.
Level is a future feature, you can safely ignore it.
That’s it! You’re now ready to start serving ads on your product placement objects.
Press Play and interact with your object in sandbox mode.