Playmaker Forum

Playmaker Updates & Downloads => Share New Actions => Topic started by: escpodgames on September 07, 2014, 08:42:11 PM

Title: UnityAds
Post by: escpodgames on September 07, 2014, 08:42:11 PM
[Edit] for Unity 5.2 support, please go to the dedicated thread (http://j.mp/1QLqs9N)


Basic actions for UnityAds on 5.1 and previous

Any questions or requests for more features, just ask.
Title: Re: UnityAds
Post by: sebaslive on September 11, 2014, 08:51:12 PM
I haven't messed around with this yet but hot diggidy dog! Do these ads work with admob or is this Unity's own ad service?
Title: Re: UnityAds
Post by: escpodgames on September 11, 2014, 09:02:13 PM
It's just unity ad service, they only advertise games.
Title: Re: UnityAds
Post by: marcos on September 12, 2014, 08:51:52 PM

Any questions or requests for more features, just ask.

These would be awesome when you have the time:

np, I'll be adding allowPrecache, isInitialized, isShowing and isSupported actions as well as a separate isReady/show ad action when I get time.

Thanks again for these! :D



Edit: Also, being able to choose placement IDs for unskippable, incentivised advertisements would be excellent, then testing if these ads have been completed or skipped.
Title: Re: UnityAds
Post by: m3ndi3 on November 04, 2014, 10:38:33 AM
Can you please include the completed video rewards??
Title: Re: UnityAds
Post by: escpodgames on November 04, 2014, 01:08:15 PM
Will work on this later in the week :)
Title: Re: UnityAds
Post by: cloud03 on November 07, 2014, 01:48:45 AM
Thanks a lot for the action for unity ads, and here the modified version a bit, for initialize, I've added an option for test mode, and for the showAd, I've added an option to use ad placement id, and another option to pause engine while ad is running...hope it is useful...
Title: Re: UnityAds
Post by: marcos on November 07, 2014, 04:32:05 AM
Awesome! I'll likely give these a whirl on the weekend.
Thank you :)
Title: Re: UnityAds
Post by: marcos on November 11, 2014, 09:32:55 PM
Done some testing with them. The pause engine while running option sometimes stalled my game when I showed an advertisement after application load. Seemed to work fine aside from that. I've just disabled the option for now, everything is working swimmingly. :)

Thanks again!

Title: Re: UnityAds
Post by: cloud03 on November 11, 2014, 11:06:27 PM
My game is using pause while running too, and it is working nicely, so I've no idea what causing that, maybe conflicting with another script?
Title: Re: UnityAds
Post by: escpodgames on November 11, 2014, 11:27:54 PM
Maybe im blind but I can't find any info on placementID other than "pictureZone" and "The default placements that are created for your game are:

default placement: Video ads, skipping enabled after 5 seconds
Rewarded placement: Only videos, no-skipping allowed
Picture only placement: For places where full video ad-experience would not fit."

Any idea on what the ID's are?!

EDIT -
defaultVideoAndPictureZone
incentivisedVideoZone
pictureZone
Title: Re: UnityAds
Post by: escpodgames on November 11, 2014, 11:29:34 PM
Also "The pause issue is fixed on iOS, but appears to still be an issue on Android with ~15% rate of occurrence"
Title: Re: UnityAds
Post by: PaulH on December 10, 2014, 08:56:42 AM
Can you please include the completed video rewards??

yes i'm also in need of the actions for this, if anyone can help?
Title: Re: UnityAds
Post by: cloud03 on December 10, 2014, 05:07:29 PM
Hi PaulH, please check the script attached below, haven't got the time tested it, but I think it should work, let me know the result...

note: just rename the file back to UnityAds_ShowAd.cs (without version number).
Title: Re: UnityAds
Post by: PaulH on December 10, 2014, 05:34:49 PM
Hi PaulH, please check the script attached below, haven't got the time tested it, but I think it should work, let me know the result...

note: just rename the file back to UnityAds_ShowAd.cs (without version number).

Hi

yes it worked perfectly, so thank you so much, i truly appreciate your help.

Thanks again

Paul
Title: Re: UnityAds
Post by: cloud03 on December 10, 2014, 06:48:47 PM
Hi Paul, glad to hear it works...can you share the screenshot how you used the action? (just the state with the action highlighted would be enough)

Thanks :)
Title: Re: UnityAds
Post by: escpodgames on January 23, 2015, 04:19:48 PM
As requested via PM, a package with the latest actions -

Title: Re: UnityAds
Post by: xhidnoda on January 25, 2015, 08:57:53 AM
You are just GREAT @LampRabbit
Title: Re: UnityAds
Post by: PlaymakerNOOB on January 28, 2015, 08:09:54 AM
Wow Thanks LampRabbit and Cloud03 for creating these great playmaker scripts
Title: Re: UnityAds
Post by: xhidnoda on February 01, 2015, 12:44:47 PM
hi @LampRabbit

I'm not sure, but the actions is not work yet for me.... i send image to see what can wrong there (?)

Can help me? once again...thanks in advace!
Title: Re: UnityAds
Post by: escpodgames on February 01, 2015, 12:53:48 PM
Hi,

Looking you're doing everything ok, I've only ever use test mode and with placement ID's so there could be an issue. Do the ads work in test mode?
Title: Re: UnityAds
Post by: laik2002 on February 02, 2015, 08:31:27 PM
hi @LampRabbit

I'm not sure, but the actions is not work yet for me.... i send image to see what can wrong there (?)

Can help me? once again...thanks in advace!

I have same problem before .Maybe the "AD init "not enough time to run , not ready to "show AD".I put "AD init "action in my first scene, or add "wait"action.
It s work for me ,hope can help you.
Title: Re: UnityAds
Post by: xhidnoda on February 03, 2015, 06:43:15 AM
nop...not working :(

@laik2002 when start my game...i start the "AD init"
@LampRabbit  i mark the check box "test mode" and the other option, now i use placement ID's as well

Title: Re: UnityAds
Post by: xhidnoda on February 04, 2015, 06:16:38 AM
Quote
Also "The pause issue is fixed on iOS, but appears to still be an issue on Android with ~15% rate of occurrence"

This still a issue on Android?
Title: Re: UnityAds
Post by: rik on February 05, 2015, 08:03:17 AM
can you make chart boost for playmaker as well
Title: Re: UnityAds
Post by: xhidnoda on February 05, 2015, 09:17:19 AM
@rik
check this

http://hutonggames.com/playmakerforum/index.php?topic=7790.msg37502#msg37502
Title: Re: UnityAds
Post by: xhidnoda on February 05, 2015, 09:21:14 AM
Ok...i solve the problem...
for some reason, unchecking the "Pause engine while ad" and put the init action and show action in two FSM (not a global event) is work  :o

Thanks for the support..!!!

BTW: i using Android Device.
Title: Re: UnityAds
Post by: rustbucket on February 05, 2015, 01:39:03 PM
Just what I needed and worked perfectly the first time I implemented. Thanks so much guys!
Title: Re: UnityAds
Post by: RAWilco on February 27, 2015, 05:54:51 AM
I seem to be having a problem with these actions. I've got a setup that is very similar to xhidnoda's, shown in the screenshots above, but it doesn't seem to be working for me.

I often find that when problems like this arise it is because I've stupidly missed something obvious somewhere. So I wanted to ask you folks if you might have done anything differently to me.

Anyway, this is what I have done to test it in my project:
- Installed Unity Ads from the Asset Store
- Installed the LampRabbit's PM Actions package
- Setup a two state FSM on an empty game object that starts with Unity Ads_Initialize (in test mode) on the first state, and Unity Ads_Show Ad in the next state (with pictureZone Placement ID).

And nothing seems to happen. The FSM just flows between the two states as if they were empty.

Any help or suggestions would of course be muchly appreciated.
Title: Re: UnityAds
Post by: xhidnoda on February 27, 2015, 06:09:27 AM
If you have a the actions test in Android...uncheck the "pause engine while AD". Ant use a wait actions (2 or 3 seconds) and then...show_ads
Title: Re: UnityAds
Post by: RAWilco on February 27, 2015, 09:03:04 AM
If you have a the actions test in Android...uncheck the "pause engine while AD". Ant use a wait actions (2 or 3 seconds) and then...show_ads

Unfortunately that doesn't seem to work either. I even tried a few really long wait times (10+ seconds) just to make sure.

Also I went through all of my project folders to ensure none of my assets are conflicting or interfering with Unity Ads. I then tried opening a fresh project and installed only Playmaker, Unity Ads and LampRabbit's actions. And since I am still having the same problem, I think it's safe to say that problem is not unique to my project (though I still have no idea what is causing it).
Title: Re: UnityAds
Post by: xhidnoda on February 27, 2015, 09:15:31 AM
I still the same problem...but when i build my game in my android device is works... but when re-build another version of my game...is not working anymore...i don't not why.
Title: Re: UnityAds
Post by: szomaza on March 04, 2015, 10:56:38 PM
I have only tested on Android and it seems to work perfectly with the test ads so far.
Quite often the ad is unavailable, so I must press the button to show it multiple times.

To solve this an action that can check if ad has already been "dowloaded" or precache is over would be nice.
This way we could only activate the "play ad" button when actually there is something to play right away.

This would be handy also when the player has viewed all the ads, so the play button does not appear anymore, only when there are ads to show again.

br,
szomaza
Title: Re: UnityAds
Post by: xhidnoda on March 05, 2015, 04:54:32 AM
I Agree
Title: Re: UnityAds
Post by: escpodgames on March 09, 2015, 11:58:11 PM
Here ya go! Thx to szomaza for testing the action

Use this action to check if the ad becomes ready and then continue with the FSM.
Title: Re: UnityAds
Post by: szomaza on March 10, 2015, 02:09:00 AM
Thanks LampRabbit it seems to work perfectly.
Can use this action to wait until the ad becomes available and then continue with the FSM, like so:
Title: Re: UnityAds
Post by: xhidnoda on March 10, 2015, 04:48:26 AM
Great..!! @LampRabbit
@szomaza
Title: Re: UnityAds
Post by: MUX on April 05, 2015, 09:00:57 PM
thanks for sharing, worked on first try.
Title: Re: UnityAds
Post by: rik on May 11, 2015, 11:06:22 AM
Hi any one make a unity package so that it will be easy to use i see many people contributed and updates can any one make package much appreciated
Title: Re: UnityAds
Post by: MattyWS on May 21, 2015, 05:11:40 PM
Thank you! This is a massive time saver as I was about to make my own.
Title: Re: UnityAds
Post by: jeanfabre on May 28, 2015, 12:47:10 AM
Hi,

 Yeah, I need to move this into a rep and also make it available on the ecosystem.

Please bump regularly :)

 Bye,

 Jean
Title: Re: UnityAds
Post by: phanbanhut on June 07, 2015, 05:49:49 AM
 :) Thanks!
Title: Re: UnityAds
Post by: Lars Steenhoff on June 25, 2015, 11:59:50 AM
great please add it to the eco system
Title: Re: UnityAds
Post by: jeanfabre on June 26, 2015, 02:42:36 AM
Hi,

 Yes, it's planned :)

 Bye,

 Jean
Title: Re: UnityAds
Post by: szomaza on July 15, 2015, 10:56:17 PM
Hi,

I am updating stuff (reinstalling the newest of Unity and every plugin I use) and got these 5 WARNINGS when adding the 3 playmaker actions for UnityAds:

Code: [Select]
Assets/PlayMaker Custom Actions/UnityAds/UnityAds_AdReady.cs(27,58): warning CS0618: `UnityEngine.Advertisements.Advertisement.isReady(string)' is obsolete: `Use Advertisement.IsReady method instead'

Assets/PlayMaker Custom Actions/UnityAds/UnityAds_Initialize.cs(27,47): warning CS0618: `UnityEngine.Advertisements.Advertisement.allowPrecache' is obsolete: `Advertisement.allowPrecache is no longer supported and does nothing'

Assets/PlayMaker Custom Actions/UnityAds/UnityAds_ShowAd.cs(46,58): warning CS0618: `UnityEngine.Advertisements.Advertisement.isReady(string)' is obsolete: `Use Advertisement.IsReady method instead'

Assets/PlayMaker Custom Actions/UnityAds/UnityAds_ShowAd.cs(53,106): warning CS0618: `UnityEngine.Advertisements.ShowOptions.pause' is obsolete: `ShowOptions.pause is no longer supported and does nothing, video ads will always pause the game'

Assets/PlayMaker Custom Actions/UnityAds/UnityAds_ShowAd.cs(55,91): warning CS0618: `UnityEngine.Advertisements.ShowOptions.pause' is obsolete: `ShowOptions.pause is no longer supported and does nothing, video ads will always pause the game'

Haven't tested, yet so not sure if any of them cause any problems or not.

Unity 5.1.1f1
Unity Ads 1.2.1
and the 3 actions from this thread: UnityAds_AdReady, UnityAds_Initialize, UnityAds_ShowAd

Br,
szomaza
Title: Re: UnityAds
Post by: jeanfabre on July 16, 2015, 04:04:20 AM
Hi,

 yep, it looks like they will need a revamp for Unity 5.

locally for you, I would simply implement their suggestions as they explain what should be used instead.

I want to add them to the ecosystem, so if you have some time, I think next week can be a reasonable target for me to put them on the Ecosystem, compliant with Unity 5.

Bye,

 Jean
Title: Re: UnityAds
Post by: szomaza on July 16, 2015, 10:21:19 PM
Hi,

It would be great to have them in the Ecosystem, in a patched up state!
But unfortunately I am pretty sure "simply implementing their suggestions" is still out of my ballpark.  :-)

br,
szomaza
Title: Re: UnityAds
Post by: playsteven on July 23, 2015, 01:51:44 AM
Hi,

Has anybody been able to get UnityAds working in Unity 5?

I'm submitting a game next week and want to look at my video ad options :)

All the best,
Steven
Title: Re: UnityAds
Post by: dougbello on July 28, 2015, 12:06:33 PM
Please, make it available on the ecosystem working for unity 5...

I'm feeling that playmaker support is little slow right now. Everything I ask for ... not working, no answers....

I'm not happy here.

Felling that have to learn how to code or I'll just have half of the options to work with unity.
Title: Re: UnityAds
Post by: dougbello on July 28, 2015, 12:23:07 PM
I don't know if it make it easier but here is the code official from unity:

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

public class AdManager : MonoBehaviour
{
    [SerializeField] string gameID = "33675";

    void Awake()
    {
        Advertisement.Initialize (gameID, true);
    }

    public void ShowAd(string zone = "")
    {
        #if UNITY_EDITOR
            StartCoroutine(WaitForAd ());
        #endif

        if (string.Equals (zone, ""))
            zone = null;

        ShowOptions options = new ShowOptions ();
        options.resultCallback = AdCallbackhandler;

        if (Advertisement.isReady (zone))
            Advertisement.Show (zone, options);
    }

    void AdCallbackhandler (ShowResult result)
    {
        switch(result)
        {
        case ShowResult.Finished:
            Debug.Log ("Ad Finished. Rewarding player...");
            break;
        case ShowResult.Skipped:
            Debug.Log ("Ad skipped. Son, I am dissapointed in you");
            break;
        case ShowResult.Failed:
            Debug.Log("I swear this has never happened to me before");
            break;
        }
    }

    IEnumerator WaitForAd()
    {
        float currentTimeScale = Time.timeScale;
        Time.timeScale = 0f;
        yield return null;

        while (Advertisement.isShowing)
            yield return null;

        Time.timeScale = currentTimeScale;
    }
}
Title: Re: UnityAds
Post by: jeanfabre on September 18, 2015, 05:55:03 AM
Hi,

 UnityAds (https://unity3d.com/services/ads) for Unity 5 is now fully covered (https://twitter.com/JeanAtPlayMaker/status/644856162857426944) with actions you can get on the Ecosystem (http://j.mp/1Esn1mF)

(https://pbs.twimg.com/media/CPL9QxzWIAAYiJr.png)

you'll mainly need "UnityAdsShowAd", as it account for both regular and reward based advertising, and will wait for ads to be ready is not already, so the action in itself covers everything you need, the other actions are for full coverage to give you access to everything if you want granular control.


 Bye,

 Jean
Title: Re: UnityAds
Post by: xhidnoda on September 18, 2015, 06:04:18 AM
@jeanfabre like always you make a great job!

I will test this in my game in a few weeks.
Title: Re: UnityAds
Post by: dougbello on September 18, 2015, 09:16:57 AM
Hi Jean, thanks a lot!

I'm testing in my game, but it gets stuck on the show Ads event and does not go anywhere. I tried building it also and it doesn't show.

It starts but does not go anywhere, I tried with and without "Is not ready event"and ge the same result, It keeps on this node.

Maybe I'm doing something wrong, but it was working fine with the previous version from LampRabbit.

Thanks again.
Title: Re: UnityAds
Post by: jeanfabre on September 18, 2015, 09:33:43 AM
Hi,

 that's odd, I did test it on device and it's working.

have you tried without gamersid?

what does it do inside the editor?


 Bye,

 Jean
Title: Re: UnityAds
Post by: dougbello on September 21, 2015, 02:52:06 PM
Hi Jean, I've been testing since saturday to make sure its nothing stupid i'm doing..(probably is)

I created a new project, imported the assets and I'm getting the same behaviour...

Using unity 5.2.0f3 Personal

Here is a screen record of it... (if you download the movie it's full quality)

https://www.dropbox.com/s/b52apecu6s0shws/unity_ads_playmaker.mov?dl=0

Maybe it help us to understand.

Thanks again.
Doug.
Title: Re: UnityAds
Post by: dougbello on September 23, 2015, 07:36:12 PM
Someone else tested it?

Is it working ok?

Thanks.
Doug.
Title: Re: UnityAds
Post by: dougbello on September 23, 2015, 07:58:54 PM
Now it's giving me this error:

Assets/PlayMaker Custom Actions/UnityAds/UnityAdsShowAd.cs(108,55): error CS0433: The imported type `UnityEngine.Advertisements.ShowResult' is defined multiple times
Title: Re: UnityAds
Post by: jeanfabre on September 23, 2015, 10:39:56 PM
Hi,

 it looks like you are conflicting several version of Unity advertisement now,

And it seems that you haven't setup at all the ad service within Unity. Did you go through the steps necessary to allow Unity ads?

1: click on the cloud icon
2: login
3: set up unity ads

(http://forum.unity3d.com/attachments/screen-shot-2015-09-10-at-3-34-55-pm-png.154040/)

Then it should work. From your previous posts, it seems you don't mentino these steps.

 so start on a fresh project, setup ads first, then run the sample provided.

http://forum.unity3d.com/threads/issues-in-migrating-to-5-2.353849/

Let me know how it goes.

 Bye,

 Jean
Title: Re: UnityAds
Post by: MUX on September 23, 2015, 11:36:05 PM
this unfortunately doesn't work for me either.

no errors to tell me why. ad just remains unready.
Title: Re: UnityAds
Post by: MUX on September 23, 2015, 11:54:08 PM
edit - ok got it to work now.
have unity bypassed the ad-type now?
that what has stopped it from working

before i used pass it either -
defaultVideoAndPictureZone
pictureZone
rewardedVideoZone

now when i add a value, ads dont work
Title: Re: UnityAds
Post by: jeanfabre on September 24, 2015, 01:42:22 AM
Hi,

 I think because it has to be setup properly on the unity side for your project. I Would contact Unity ads team to get a proper explaination of zone and gamers id to know what they and how to work with them.

 Bye,

 Jean
Title: Re: UnityAds
Post by: dougbello on September 24, 2015, 01:45:28 PM
Jean, your new actions work with the sdk as well or just with the new dashboard for unity ads?

I can see many users having problems with the new sdk internal: http://forum.unity3d.com/threads/unity-ads-crashing-ios-in-5-2.354405/

http://forum.unity3d.com/threads/issues-in-migrating-to-5-2.353849/

http://forum.unity3d.com/forums/unity-ads.67/

Should I try importing the sdk or your solution just works for the services tab?

Thanks,
Doug.
Title: Re: UnityAds
Post by: jeanfabre on September 24, 2015, 10:21:19 PM
Hi,

 This solution works with the service based Advertisment system, not the sdk you have to manually install. For this you can use the old set of actions I presume.


 Bye,

 Jean
Title: Re: UnityAds
Post by: MUX on September 24, 2015, 10:41:10 PM
Hi,

 This solution works with the service based Advertisment system, not the sdk you have to manually install. For this you can use the old set of actions I presume.


 Bye,

 Jean

confirming what Jean said & recommended, i have reverted to the older actions & asset store SDK till 5.2.1 is bit more stable.
Title: Re: UnityAds
Post by: jeanfabre on September 24, 2015, 11:06:09 PM
Hi,

 I'll make a note on this, what a mess...

Bye,

 Jean
Title: Re: UnityAds
Post by: szomaza on October 04, 2015, 01:57:39 AM
Hi All,

I am having quite a trouble setting up Unity Ads again in Unity 5.2.1f1.
Previously I managed to get it to work in Unity 4.6 with the Unity Ads SKD from Asset Store and the original Playmaker actions.
Now with the Unity Services way of doing things and the new actions from Ecosystem I am not sure where the Game ID or Placement ID goes and how to set this up?

Do we not need to initialize and precache the ads anymore?
Where do I find some documentation for the new actions?

Thanks in advance,
szomaza
Title: Re: UnityAds
Post by: dougbello on October 05, 2015, 12:36:34 PM
Hi szomaza,

Same as you, I lost  a lot of time trying to make things work again...

Now its kind of working... I can see the ads working, what i had to do is to delete and make a new ad game in unity dashboard online, then copy the number of the game inside the unity services tab.

With Jean new actions it works, the play and reward work, but the skip and the others doesn't show anything for me...

(anyway you will see them just when you run on iOS after xcode).

1. the game id goes inside the services tab on unity
2. you don't need to pre cache, unity does that for you

Yes some more documentation on the new playmaker actions would be awesome too!!

basically, once you manage to put your game on the unity network, using services tab and the unity dashboard for ads, the actions start to work.

Besides when there is a problem, this i could not manage to see working on my device or in unity. I can not see my message of no ads, when the ads doesn't show or encounter any problem.

If someone have more info, please share.
Thanks,
Doug.
Title: Re: UnityAds
Post by: jeanfabre on October 08, 2015, 05:34:14 AM
Hi,

 Indeed this situation with Unity ads is messy. Unfortunatly, Unity has changed many times the setup system and now the web is polluted with obsolete information.

 Please follow the procedure from the new "Services" inspector ( accessible from the cloud button or the window menu)

you will find this link
http://unityads.unity3d.com/help/Documentation%20for%20Publishers/GettingStarted

which stipulate 5.2 changed things around, so the old way is for 5.1, and this package I just did is for 5.2

Bye,

 Jean