Playmaker Forum

PlayMaker Help & Tips => Unity Services => Topic started by: jongkook on December 28, 2015, 06:56:00 AM

Title: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jongkook on December 28, 2015, 06:56:00 AM
I would like to know how to set up an UnityAds using the services included in Unity.
When user click the button the movie is being played
After viewing the video advertising that would like to set the coin as a reward.
Unity version 5.3.1
Title: Re: I would like to know how to set up a UnityAds.
Post by: jeanfabre on December 29, 2015, 04:37:49 PM
Hi,

 Are you able to show an ad properly already?

If you are not, the actions are available on the Ecosystem (http://j.mp/1Esn1mF)

(http://i.imgur.com/pJgkUUU.png)

WARNING: do not follow the Unit doc when it says you need to download a package from the asset store, Unity 5.3 comes with Unity ads as is, so you don't need anything extra from Unity for ads to work if you are on 5.3

-- use "UnityAdsInitialize" at the beginning of your scene ( use the GameId from the Unity setup on the Cloud inspector)

(http://i.imgur.com/sOD9dqq.png)

-- use "UnityAdsShowAd" when you want to show an ad

-- the other "UnityAdsXXX" are for more granular control over ads, and not mandatory for the minimum setup.



If you are already setup, then it's a question of using the action "UnityAdsShowAd" properly, and using the 3 different event you can get when showing an ad:

-- Skipped
-- Success
-- Failed

obviously, you only want to reward your user if this action fires the "Success" event.

 Does that make sense?

Let me know if you need more clarification.

Bye,

 Jean
Title: Re: I would like to know how to set up a UnityAds.
Post by: jongkook on December 30, 2015, 04:59:08 AM
I was wondering how to do this in the playmaker editor.
Title: Re: I would like to know how to set up a UnityAds.
Post by: jeanfabre on December 31, 2015, 05:12:56 AM
Hi,

 Here's a screenshot ( thanks Alex :) ) on a basic setup.

 Let us celebrate new eves, and early next week, I'll do a video and sample from start to finish on how to integrate UnityAds, ok?

(http://hutonggames.com/docs/img/UnityAds.png)


Bye,

 Jean
Title: Re: I would like to know how to set up a UnityAds.
Post by: jongkook on December 31, 2015, 06:39:55 AM
Thank you. The test results are good.
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 11, 2016, 11:12:39 AM
Hi. How far are you with the video? ;)

Thx in advance.
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 11, 2016, 11:38:08 AM
Hi,

 Pushing the sample on the Ecosystem likely tomorow morning, with the video :)

 Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 13, 2016, 02:05:45 AM
Hi,

 Full tutorial Video and working sample are up on the Ecosystem (http://j.mp/1Esn1mF)

https://twitter.com/JeanAtPlayMaker/status/686905884061110272


Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 13, 2016, 11:18:35 AM
Thx a lot for the tutorial. I have one question. I don´t build on IOS. Only Android.
do I also have to choose IL2CPP at scripting backend for android? Because if I choose IL2CPP then Unity say that it is unsupported for android. In unity editor it seems to work. but not on device. it says ad ready but fails on device too. tried it in testmode and without testmode.

Pls could you help?

sry for my english ;)

thx in advance
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 13, 2016, 11:38:24 AM
Hi,

 Unfortunatly I don't own an android device, so I can't test in this case. I am pretty sure Unity Ads works on Android, but may require specific player settings indeed.

if you deploy without il2cpp does it work?

 Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 13, 2016, 11:57:16 AM
normaly i build with Mono2x and everything works except unity ads. if i try build with il2cpp then after 3/4 of the buildprocess unity says "invalid NDK version - unable to detect NDK version, please pick a different folder.

someone else may have an android device and an idea how this works? ;)
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 13, 2016, 12:49:17 PM
Hi,

 Well, then do't use ILC2PP on android, maybe IL2CPP is only mandatory when distributing for the IOS app store.

 Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 13, 2016, 05:09:29 PM
but with mono2x it also don´t works
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 14, 2016, 01:16:00 AM
Hi,

 Ah ok, sorry about the confusion. Can you try a project without PlayMaker that feature ads ( you have code sample in the ads doc). If that doesn't work still, then you should contact Unity, else, we'll look further.

Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 14, 2016, 08:34:32 AM
Ok. I installed the newest unity version and made project without playmaker. enabled unity ads and choose the code snippet from here http://unityads.unity3d.com/help/monetization/integration-guide-unity#showing-an-ad-placement (http://unityads.unity3d.com/help/monetization/integration-guide-unity#showing-an-ad-placement)

This works on my android device without problems.

then i installed playmaker 1.8 and ecosystem to this project. downloaded your sample from ecosystem. and this give me the fail event on my device and no ads.

UnityVersion: 5.3.1f1
Playmaker: 1.8.0f40
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 14, 2016, 09:22:38 AM
Hi,

 ok, and what do you get in the android log when you run the ecosystem sample? Unity outputs how the unity ad service got initialized.

 Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 14, 2016, 10:37:21 AM
Ok i tried my best. This is what i got. I attached 2 log files. the log1.txt are all logs with my application name from project without playmaker. and the log2.txt are all logs with my application name from project with playmaker sample.

i dont know if i done it right.

i have no clue how to read this logs sorry.
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 14, 2016, 11:56:27 AM
Hi,

 ok, there is no feedback it seems, so it's as if UnityAds isn't initialized at all.

 in the sample, what does the label says before you press "show Ad", if it stays "initialize..." then you may need to initialize it manually. there is an action for this on the Ecosystem, "UnityAdInitialize", use it ( and fill up the GameId properly from the service inspector in advanced tab)

 I don't have an android device unfortunatly, so I can't test myself. If someone reading this thread can double check It would be great :)


Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 14, 2016, 12:19:32 PM
the label change to "ad is ready". and on button press direct to failed. in the log from the test without playmaker is no feddback from unityads too. and this works.

i dont know. pls someone with an android device help  :)
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 14, 2016, 01:51:53 PM
Hi,

 uhm, very interesting...

ok, on the ecosystem there is an action call UnityAdsSetDEbugLevel.

 Can you use this one on start and set the debug level to "info" or "debug". We need to understand why it fails.

Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 14, 2016, 01:55:51 PM
i test a bit myself. i uncomment the debug.logs in the handleshowresult in the Unity Ads Show Ad action. if i start this then in editor it fails direct and give an error in the debuglog.

"The ad failed to be shown.
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.Actions.UnityAdsShowAd:HandleShowResult(ShowResult) (at Assets/PlayMaker Custom Actions/UnityAds/UnityAdsShowAd.cs:121)
UnityEngine.Advertisements.Advertisement:Show(String, ShowOptions)
HutongGames.PlayMaker.Actions.UnityAdsShowAd:ShowAd() (at Assets/PlayMaker Custom Actions/UnityAds/UnityAdsShowAd.cs:82)
HutongGames.PlayMaker.Actions.UnityAdsShowAd:OnUpdate() (at Assets/PlayMaker Custom Actions/UnityAds/UnityAdsShowAd.cs:71)
HutongGames.PlayMaker.FsmState:OnUpdate() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:255)
HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2170)
HutongGames.PlayMaker.Fsm:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1425)
PlayMakerFSM:Update() (at c:/Users/Alex/Documents/Unity/Playmaker/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:431)
"
But i test it now with the debugaction on start.


I attached another log with your sample. there is something with unityads in the logs. but i dont know what it all means.

thx in advance.
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 14, 2016, 02:44:22 PM
So. I changed your action and now it works first of all. i attached the changed action.

pls have a look ;)

thx in advance
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 15, 2016, 03:43:41 AM
Hi,

 ok, that's very odd indeed.

 I am indeed finally getting an android device now, and so I'll be able to test. I'll update the code on the Ecosystem once I have verified it and cleaned up what's not working.

I am glad you found the issue! Thanks for this

Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 18, 2016, 07:29:21 AM
I am cursed with devices...

Got an android device, even took a 5 year care plan just to make sure it'll last ( and I did not trust it anyway), and guess what:

 First build and run on the device, it almost melted on me... I don't know, the screen went crazy, device crashed, and since then I wasn't able to boot it up...

IOS may be more expensive and constraining, but I know why and I am fine with the extra price because I know the device works and delivers! I had the same very bad experiences with Blackberry and Windows phones... I would like it to be otherwise for sure...

 So, I am sorry guys, it seems the device will get back into the shop for a replacement but it may take few days at least...

Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 18, 2016, 01:35:55 PM
Ok no problem. thx for your effort. hope you get it solved.
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Weedsh on January 27, 2016, 06:21:31 PM
Hey jeanfabre.

Have you solved your android problems and any good news?

greets
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on January 29, 2016, 12:51:59 AM
Hi,

 unfortunatly, this will take at least 20 days, time for the device to go under warantee.. Boy I did have a go a the seller at the shop, as he did not wanted to swap the phone, I guess I am just used to the IOS way... "it's broken?! take a new one, and go home with a device that works..." I had the experience ,yself with my ipad where sound was dead, so I know it's true... here I have a device that you can't even use and I have to wait....

 as soon as I have my device back, I'll be checking and updating accordingly the ad actions to work properly on android.

Bye,

 Jean
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Phuzz on February 22, 2016, 08:05:43 AM
Hello,

I have tried the Action provided by Weedsh and it seems like it is working fine on my Android device, the Action from Ecosystem did not work.

Thank you  :)
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: Zeldag on February 22, 2016, 10:22:01 AM
Hi,

I dont have a solution to the ad problem, but if you need to test on android and have no device, bluestacks should do it:

It is an android emulation software for windows. It is legal, free and can be useful in android development:

http://www.bluestacks.com

Hope it helps...
Title: Re: [SOLVED] I would like to know how to set up a UnityAds.
Post by: jeanfabre on March 28, 2016, 03:13:50 AM
Hi,

 I have provided an update for this, I finally got a android device and could test and solve the problem. If you still have problem, simply download the latest version of the package and try with it.


Let me know how it goes.

Bye,

 Jean