How to place ads in a ready game + one other question

Hi again,
I have completed my first game and was wondering if anybody know of a way that actually works to get either Google admob or Unity ads implemented into my game. I have tried at least 5 YouTube videos on how to implement each google admob and unity ads without success. Is it even possible to put ads in a ready game after it has been exported to unity? Any information will be helpful. Also, I’m brand new to coding so please word your response simply if it has to do with coding. Also, one other unrelated thing. Is it possible to have a multi scene game in unity by creating multiple games in ready?
Example:
One gam is ready has three buttons for level one, two, and three. Depending on what button you push, it will open up a new game in ready. At the end of the level, there would be another button to direct you back to the main game. Will this be able to be published as a single game in unity?
Hopefully I explained that well enough.
Let me know if you have anything useful!
Thanks!

3 Likes

I have some experience with using Unity Ads, but not admob.

What I do know for certain is that Ready does not prevent your project from having ads. Instead, it’s actually encouraged if you wish to make profit off of your game.

With these 5 tutorials you watched, please answer these questions for me if possible:

  • have you downloaded the unity ads package from the unity package manager? (You can find it under Monetization)
  • do you have the latest version of unity ads?
  • are you trying to implement ads that are just a few seconds and are able to be skipped, or are you trying to implement ads that require you to watch the full ad with no skips?

If you have not, please watch the tutorial from Unity themselves. It’s very recent and up to date. These are the tutorials I used to get my ads working in unity.

Whenever you have an ad, there should be an example of what it could look like whenever you try to test it in the Unity engine. However, it will not show a real ad unless you export the project. If you want ads, please make sure your project is linked to your games on the google play store or App Store if you wish to publish onto those platforms. So, what I mean is, you need to have a developer account for either platform if you wish to publish onto them and release games to those stores. The tutorials I showed should explain why this is the case.

I have tried to explain this to the best of my ability. If you have any questions, please don’t hesitate to ask me! :slight_smile:

3 Likes

Thanks @Dravin for your response

have you downloaded the unity ads package from the unity package manager? (You can find it under Monetization)*

Yes, I have done this multiple times without errors

do you have the latest version of unity ads*

I think so? How to do you check this? I just downloaded the asset from the store and tired ads on under windows-> services-> ads

are you trying to implement ads that are just a few seconds and are able to be skipped, or are you trying to implement ads that require you to watch the full ad with no skips?*

Actually, I wanted to have a banner ad that would show at the bottom of the screen for then entire time the app is open, also if it’s possible I wanted a way to have an in app purchase to remove the ad.

When you said that the ads would not show until the game is published, I know that, but don’t you get a screen (or banner in my case) that says the ads are working correctly?

Also, I was a little confused when you said

[quote=“Dravins, post:2, topic:4382”]
So, what I mean is, you need to have a developer account for either platform if you wish to publish onto them and release games to those stores.
[/quote
Does this mean I need a developer account with unity, or just with the App Store. (I have a unity ID and can access the dashboard). Do I need an developer account with google play to implement the ads or just to publish the game?

4 Likes

Hmm… I’m not sure about banner ads but they should be really easy to add.

What I meant by connecting your game to a developer account- you need a developer account for google play if you wish to publish on google play. So, when you create a new project off of the google play store to put your unity game onto, you will receive an ID for that game. You must connect that ID to your unity dashboard where your game is listed.

There is tutorial on what I mean:

You mentioned that you downloaded the monetization pack off the asset store. I’m not sure if this is the cause of the problem but what I did was download the pack off the package manager (so Window > Package Manager) and list all packages. All packages are in alphabetical order.

Also you do get a screen about if the ads are working. I mentioned how if it’s set up right and the code is implanted, there should be a sign that it worked when you start the game.

3 Likes

Thanks @Dravin!

As for developer account with the play store - I don’t need that until I publish the game correct? When I publish the game, I would have to link my games ID to unity, right?

The video did clear up a few things for me (thanks) but the only think I’m concerned about now is that how can I tell the game to open the ad upon the start of the game? (I’m sure its an easy coding thing, but as said recently, I’m brand new to all of this and haven’t had the chance to learn anything yet). You would have to change the

if (Input.GetKeyDown(KeyCode.E))

to something ealse that would say something like

if (game open)
{
if (Advertisement.IsReady(“banner”))
{
Advertisement.Show(“banner”);
}
}

obviously the (if (game open)) line is the one line stuck on

I also tried the what the video did, just to see if video ads work, and nothing happened. Here is my script code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
. <that dot is not in the code
public class admanager : MonoBehaviour {
// Update is called once per frame
void Update() {
if (Input.GetKeyDown(KeyCode.E))
{
if (Advertisement.IsReady(“video”))
{
Advertisement.Show(“video”);
}
}
}
}

and here are some screenshots. Again, I could not get videos to show, and banners dont work either.



One other thing, I thought that you had to put your game ID somewhere in the code (The ID from the last screenshot) But I did not see that anywhere in the video.

Sorry is this is too long and confusing :slight_smile:
Thanks again for your help!

Edit: Do I maybe have to login into the unity program (not the web dashboard but the actual program) for this to work?

2 Likes

I am glad those videos helped a bit! The games actually do not have to be published for this to work! You just need the app set up on the Play Store/App Store in order for this work. Google or Apple do not have to publish the game just so ads can work.

You are actually correct. You must implement the ID into the code.

Here is my AdScript that I used for my game, Not Our Home, for iOS and Android.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;

public class AdsScript : MonoBehaviour
{
// Start is called before the first frame update
IEnumerator Start()
{
Advertisement.Initialize(“6317382”, true); //iOS Ad
Advertisement.Initialize(“9172513”, true); //Android Ad

    while (!Advertisement.IsReady())
    yield return null;

    Advertisement.Show();  
}

}

In my game, I have objects that contain this script. Whenever those objects are active in the scene, this code initializes an Ad and loads it in. Whenever it loads, the ad will show up.

If you want, feel free to use my code as reference. Place it onto any object that is always active so a banner can show up.

My code shows a “video” so you will have to switch it to a banner ad.
And yes. Please log into the Unity program that you used for your unity dashboard.

Also the ID numbers I used are not real and are just used for an example. This is mainly for the safety of my own game.

2 Likes

@Dravin, Thanks for your help!
Unfortunately, when I replaced my code with what you game me, inserted by own ad numbers from the unity dashboard, I get the following errors. The errors happen weather I am using your fake numbers or my real numbers. I am now signed into in unity program have created a new empty object in the hierarchy that I have attached to script to. Also, I’m not sure how you tell it to do a banner ad, and not a video one as there is no spot where your code says “video” that i can change to “banner”
Please let me know what’s going on (or if I have made a dumb mistake)
Thanks!


Edit: Here is another picture that may or may not help!

3 Likes

I believe this error is because you use the monetization pack from the unity asset store instead of the unity package manager. If you don’t have the unity package version, please try switching to that. There’s something on your end that is causing those numbers not to be recognized and I think that may be the case.

If you wish to find it go to Window > Package Manager then list all packages. They’re all in alphabetical order.

Also in Advertisement.Show(); change it to Advertisement.Show(“banner”);

This should work :crossed_fingers::crossed_fingers: (make sure ad services are still on as well)

(Also I mention the package manager because it’s more up-to-date and I believe the one from the asset store is outdated)

2 Likes

Hi @Dravin, unfortunately, the advertisements are still not working. What’s going on? I updated the package (see screenshot) and re-started unity. I still get the unexpected character error.



Hopefully there is something here you can work from.
Again, thanks so much for you help!

3 Likes

@greenreader9 I am not sure about it as I don’t have much experience with Unity, but probably you might not be using the most suitable version that can incorporate Unity Ads in a Ready Maker game. What Unity version are you actually using?

2 Likes

@samsajwani1234, It’s 2019.4.8f1 Long-Term-Support
unity version
Hope this helps!

3 Likes

Hmm… I don’t think that there is anything wrong with the version. However, I am not sure about it. Probably @Ready @Dravin could clarify.

2 Likes

This is so strange… I don’t understand why the quote marks aren’t working. I gave everything that I did to do this so I’m really confused on how this isn’t working :thinking:

I will try to look into this and see if I find anything.

2 Likes

Okay, I looked for some solutions so I hope these help.

  1. Please make sure you have test mode on for the ad services, and enable built-in ad extension

  1. If nothing works, create a backup project for your game. To do this, create a new folder and copy the Assets, Project Settings, Packages, and User Settings (if you have one) folders to the new folder.

Then, re-import the project (not the backup). To do this, go to Assets > Reimport All

This will reimport everything so this may or may not fix the issue, but it’s worth a try. Please make sure you have a backup though because sometimes it can mess up!

2 Likes

@Dravin, thanks for your help, bus its still not working. Hopefully the screenshots are helpful (I took a ton). Not only did I do Assets > Reimport All, I also went into Ready and re-exported the project, created a new Unity project, started Unity ads, Unity analytics, created a new script, changed the numbers to match the new game in the Unity Dashboard, created a new empty object in my hierarchy, and attached the script. I probably forgot to mention something in the explanation here, but hopefully the screenshots reflect what I did. As previously stated, My unity version is 2019.4.8f1 LTS with android, IOS, and windows build support. I also have Android studio installed on my PC if that makes a difference.
Hope these help.



Thanks for all your help!

3 Likes

I have absolutely no idea, I’m really sorry :frowning:

I’m really trying to see what’s causing the “” not the recognized. My only guess is to try and delete the Advertisement.Initialize and do this

if(Advertisement.isReady == true) {
Advertisement.Show(“banner”):
}

But that code in void Start()

If this does not work, and @Ready can’t find an answer, I can only recommend going to:

https://forum.unity.com/forums/editor-general-support.10/

Or

2 Likes

Wait, try this:

At the top where it says AdScript change it to admanager.

I really hope that works. The script name doesn’t match.

So public class : AdScript

Change that to:

public class : admanager

I’m just now noticing this!! I really apologize! This may be the solution, I really hope!

2 Likes

@greenreader9 if this solution still does not work, try replacing double-quotation marks “” with single-quotation marks ‘’

2 Likes

@samsajwani1234 sadly that won’t work. It has to be double quotes

2 Likes

Oh! I don’t have any idea about this…

2 Likes