Using SDK
Create Ad Surfaces for your game in Unity using the SDK.
Last updated
Create Ad Surfaces for your game in Unity using the SDK.
Last updated
Once the Rene SDK is successfully installed and opened, you can start using it. If you correctly added the API Credentials you generated from your game on the Portal to the Reneverse Settings menu in Unity, click Sync Game Assets. Once you are successfully synced through your API keys with the ReneVerse portal, you will see the ad surfaces fold out and assets foldout containing whether branded or ownable ones depending on what you have created on the portal.
If you open the Standalone Ad Surfaces or of a particular asset (whether ownable or branded), you'll see a list of Ad Surfaces that you created within the ReneVerse Portal, including their associated data, including an AdSurfaceId
for the surface, its AdType
, Interactivity
, and TargetingTags
, as well as a button to Create Ad Surface. Clicking this will generate the ad surface in your Unity project, already predefined and related to the data on the portal associated with this surface. Upon clicking Create Ad Surface, you'll be entered into your Unity scene with your predefined Ad Surface, whose details will be visible in the Inspector menu on the right-hand side of your screen.
There are a couple of details that are useful to know about creating Ad surface.
The creation of the Ad surface supports built-in and universal render pipelines of unity. The material that is set up for it depends on current graphics settings in the project. Depending on it, there is assigned a corresponding material to the ad surface. However, you can completely change it (in the Packages/com.reneverse.services/Resources/Materials) or once the ad surface is instantiated, you can add your own material fitting your project needs.
Another detail is that the ad surface is created inside the GameObject selected in the hierarchy. This is done for convenience, because in most cases, the ad surfaces are going to be placed as child objects inside the assets that will be representing the potential area for this ad surface, whether it's going to be banners, shop windows, or anything you would like to turn into an advertisement in your project.
Ad surfaces are integrated into current Unity Prefab workflow, meaning that once you have one prefab or prefab variant in your scene representing the potential surface needed to be populated with ads, you can select it and add the ad surface into it and override this prefab and all the corresponding prefabs will get these ad surfaces without a problem, potentially giving you the opportunity to integrate our services extremely quickly if you have the correct prefab-centered project structure.
Once the ad surface is created in the scene or prefab, you could see its parameters in the inspector. Just to check that this is the one that you wanted to have in your project, corresponding to the one that you have on the Reneverse portal.
The instantiated ad surfaces have the relative scale correspondent to the resolution that you set up on the portal. Of course, you can scale the ad surface, but keep in mind that you should do all the manipulations with transform only on the parent object. And it is fine to scale. You could even stretch and shrink if you need to, but keep in mind that in this case, the content coming to these surfaces might not be depicting as intended.
The content of the add surface itself in the global position mode is showing opposites to the Z axis of unity. This is done this way because the only quad polygon of Quad in unity that you create is opposite to the Z axis.
The visual representation in the scene is a gizmo that represents the ad surface once it starts playing. Also in the middle you could see the ad surface ID for the quick visual reference make sure that you have correct ad surfaces at the correct places corresponding to the ones you have on the Reneverse portal created.
You can click on the reference button in the Ad Surface Component to get to this page on the documentation, as on most of the other Unity-provided components.
Serve Ad On Start allows you to start the process of serving the Ad on the first frame meaning on Start() method
Gizmos in the scene view are for your convenience, they show the side from which you watch the Ad, its type and ID that you can check on the Portal that it's matching. You can always disable/ adjust gizmos in the correspondent button that is highlighted in the screenshot. Keep in mind that for debugging, you can always Disable/Enable gizmos in the Play mode as well.
You can duplicate existing ad surfaces, meaning that even if in your profile on the Reneverse website you have just one ad surface, in the actual game there could be thousands of them, preferably in a prefab, since it will help you to modify it within seconds on each instance, but essentially it's going to be just one ad surface with one ID.
Once an individual ad surface is selected and play mode is on, meaning your game is running, there will appear a button to check the advertisement, how it will look. But keep in mind that it will serve the current advertisement if there is no advertisement campaign running, meaning you have no content to receive. You will get the correspondent log for it and you can check on the website what could be the issue.
However, there is implemented the possibility to play rene ads on multiple of them, meaning that if you select thousands of video ad surfaces, hit play button in unity and select play ad in the inspector, the ads will be playing. The only limitation is that they should be of the same type, meaning that you can select only video ad surfaces together or only banner ad surfaces together. This happens because of the Unity editor's way of calling derived objects, and is easily handled if you search the corresponding game objects in the hierarchy and select only them. In our case, it's either video ad surfaces or banner ad surfaces, and using CTRL-A you could select all of them.
Once you play multiple advertisements, you could see that they are played if the ad surface corresponds to currently present content in currently running ad campaign. And this play ad button corresponds to one of the two public methods that you might be using, namely, PlayAd()
and StopAd()
. And once the ad is played, you can stop it afterward. For now, the video and banner are cached, meaning that if it's served once to the user, another time it will be taken from the cache, meaning that the second time serving of the ad does not count as serving. Only the first one is considered to be serving the advertisement.
Notice how once the advertisement is served, the system automatically starts showing the current percentage of the seen ad relative to the game screen. It happens automatically and is lightweight. However, the Camera that you will be using for looking at Ads should be marked MainCamera
which is default in Unity.
Coding is not necessary if you ticked Serve Ad On Start in the inspector of surface and you have camera tagged MainCamera
(everything should start automatically). However, if you need more control over when ads are loaded, all you need to do is calling public method ServeAd()
on the surfaces you want the ads to be served to (no matter which type they have). Getting reference to particular ad surfaces is up to you.
For letting your user to connect to ReneVerse portal to gain its benefits you can essentially use 3 methods:
2) Game Connect
That should be it to integrate and use the ReneVerse SDK into your game! Feel free to check Player Authentication to see how to use our SDK from the code perspective.