Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #1 

Hello guys,

As you may have seen my thread where I told you guys that I am new to coding/scripting. Anyway, I made a simple 2D game with the help of a template and some tutorials and it runs good on android devices, but I want to monetize it with ads. I downloaded the Chartboost Unitypackage from their site and also download a plugin from this site:

http://howtomakemobilegames.forumchitchat.com/post/free-ad-network-package-for-unity-6981043

Which should make the implementation easier. I was able to make the ads show when I click on the GUI but that was ready made, can someone please write a simple C# script where when the scene loads the Chartboost ads appear. I would really really appreciate that! Thanks you!

0
Salus Games

Member
Registered:
Posts: 85
Reply with quote  #2 
I won't give you the code yet but I will point you in the right direction [tongue]

http://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html

Instead of having it show when you click a button, have it show in that function instead. If you still can't work out how to do it, no worries. Reply here and I will give you a example. [smile]

__________________
http://www.salusgames.com - Our passion is making great quality games across all genre's.
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #3 

Hey,

 

Thank you for the reply and for the suggestion. Well I tried to do something but I am getting Parsing Error. Can you please help me by writing the script and commenting the important things so I understand how this works? I'd really appreciate that! Thanks in advance

0
EpicStudios

Senior Member
Registered:
Posts: 195
Reply with quote  #4 
First of, make sure your application platform is set to android in build settings, then if you are using the official Chartboost Unity plugin do - File -> Chartboost -> Android Setup -> Setup and let Unity do its thing. Next drag the CBManger.cs onto a gameobject in the scene such as the Main Camera. Create a new C# script and in the start function past this code:


CBBinding.init("INSERT APP ID", "INSERT APP SIGNATURE");
CBBinding.showInterstitial(null);


Put that script on the maincamera also and you should be all set. Now build for android and check if it works. If you have anymore questions feel free to ask. Good luck [smile]

BTW there is a guide on the chartboost site that explains everything extensively - https://answers.chartboost.com/hc/en-us/articles/200780379-Unity-Integrations 
0
Crichton333

Avatar / Picture

Senior Member
Registered:
Posts: 273
Reply with quote  #5 
Did you try the official tutorial ? Theres just a couple of lines of code to add.

https://answers.chartboost.com/hc/en-us/articles/200780379-Unity-Integrations

__________________

"Smoke me a kipper i'll be back for breakfast." -- iOS: Nebula Virtual Reality

0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #6 

Hello EpicStudios,

 

Thank you very much for your help and the script. I followed all the steps and eveything went fine, but after I made the C# script that you told me to, I get this error:

Assets/Plugins/Chartboost/ShowAds.cs(9,17): error CS0103: The name `CBBinding' does not exist in the current context

Assets/Plugins/Chartboost/ShowAds.cs(10,17): error CS0103: The name `CBBinding' does not exist in the current context

Can you please explain to me what should I do to fix this or what did I do wrong?
 
Thanks again!
 
EDIT: I tried the official one, I wrote the first script and got no errors, but does this mean I have to write to more scripts: On Android, you must also override two more MonoBehaviour methods to help control the lifecycle of the Chartboost plugin.
0
EpicStudios

Senior Member
Registered:
Posts: 195
Reply with quote  #7 
No that one script should allow you to show ads when the app starts. Oh and that error you were talking about is happening probably because you do not have the line

Using Chartboost

At the top of the file.
0
Salus Games

Member
Registered:
Posts: 85
Reply with quote  #8 

using UnityEngine;
using System.Collections;
using Chartboost;

public class Example : MonoBehaviour {

   void Start(){
      CBBinding.showInterstitial(null);
      CBBinding.cacheInterstitial(null);
   }
    
}


If your using my ad package just put that script somewhere in the demo scene and it will load a ad when your scene loads.

__________________
http://www.salusgames.com - Our passion is making great quality games across all genre's.
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #9 

Thank you guys for your help! I was able to make the ad show with Epic Studios script, but how can I make the X button work, so when I click on it, the ad disappears. Thank you again guys!

 

EDIT: Ok guys, I was able to make the ad disappear when I press the back button. But, sometimes the App crashers when I press the back button to make the ad disappear. Any idea why?

0
EpicStudios

Senior Member
Registered:
Posts: 195
Reply with quote  #10 
Could you share what logcat says about what happened.
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #11 
Thanks for the reply EpicStudios. Well, I am trying the app on my Android device which is not connected to the computer at all, so how do I know where to see logcat?
0
EpicStudios

Senior Member
Registered:
Posts: 195
Reply with quote  #12 
Quote:
Originally Posted by kPodi
Thanks for the reply EpicStudios. Well, I am trying the app on my Android device which is not connected to the computer at all, so how do I know where to see logcat?


Hey, could you email me your unity project to epicstudios27@gmail.com

I am really curious to see whats wrong as Chartboost has never been an issue for me. 

I'll get back to you after I find the bug.
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #13 

Hey Epic,

 

Thank you very much for your help, I really appreciate it! However, I was able to make it work smoothly with Salus Games plugin and script. Thanks to all who helped me!

0
EpicStudios

Senior Member
Registered:
Posts: 195
Reply with quote  #14 
Quote:
Originally Posted by kPodi

Hey Epic,

 

Thank you very much for your help, I really appreciate it! However, I was able to make it work smoothly with Salus Games plugin and script. Thanks to all who helped me!



Great to hear. Good luck with your games [smile]
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #15 

Actually guys, I got another problem! When I try the test mode the test ads appear, but when I desable the test mode, the ads don't appear at all...

EDIT: Sometimes it shows, sometimes not!

0
Salus Games

Member
Registered:
Posts: 85
Reply with quote  #16 
Thats normal for chartboost. It just means they didn't have a ad to show you at that time based on their criteria (location/device/target audiance/etc). You can set up a test device to ignore these but I have yet to get a test device working myself.

https://answers.chartboost.com/hc/en-us/articles/200780279-General#test

__________________
http://www.salusgames.com - Our passion is making great quality games across all genre's.
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #17 
Ok thank you very much for that information Salus Games!
0
EpicStudios

Senior Member
Registered:
Posts: 195
Reply with quote  #18 
Quote:
Originally Posted by kPodi

Actually guys, I got another problem! When I try the test mode the test ads appear, but when I desable the test mode, the ads don't appear at all...

EDIT: Sometimes it shows, sometimes not!



Thats perfectly normal, basically it means Chartboost doesnt have any ads to give you. When you request an ad and chartboost has one is the only time you will see one. Your fill rate varies in different countries.
0
kPodi

Junior Member
Registered:
Posts: 17
Reply with quote  #19 
Well I think I should add AdMob ads too, so there is a bigger chance to earn something when there are no Chartboost ads available! Thank you very much for the information, really appreciate it!
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.