UNITY LEVELPLAY TUTORIAL Banner, Interstitial and Rewarded Ads Mediation tutorial #unity #unityads

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what is up guys and welcome to another video all to do with unity specifically Unity level play Unity level play is basically where unity and iron Source came together created Unity level play which gives you guys access to more adapters and a few extra things within the dashboard and easier testing in my opinion there's a few things and I just want to iron out the start of the video and that is you need to make sure that your Unity editor is above 2017 point something I'm going to put it right here you need to also take into account if you're making an app for Android and iOS then at this point you need to be in an iOS development platform that would very much be like mac and I will be covering the iOS element of creator of implementing the iron Source Unity level play in a separate video which will be linked down in the description as soon as it is ready so let's get started right so this is the platform which I am showing you today and going to be building in the unity level play SDK into the platform so we've just brokenly go we've got a load Banner a dispose Banner a load full size ads and the show full size ad as well as the show rewarded ad so these are just going to act as placeholders where we can control when we call the functions now realistically you would have like the load Banner load as soon as the SDK is ready and you'll use a disposed one as and when like if there was going to pause menu or going to screen where you don't want the banner to show um and then you just load it as soon as you come out of that scene the load full size ads you'd have that probably loaded at the start and then you just show it as and when you wanted to so for example after a couple of levels within the game you'd be showing it them or like after each death or depending on how your app is set up the end of each level whichever way you would be showing it then as soon as you finish showing the app showing the ad you would then reload another ad ready for the next time it is ready to go and then also you've got rewarded ad which goes with the name it will be a it will give us a reward which we will display at the bottom here with the score function now with unity level play there is a fourth option which is off a wall now I don't have an experienced that yet I'm just going to get verified from Iron source to be able to test that out but as soon as I do as soon as I do understand it I will be creating a video on that so to get started this scene represents where you are in the in your game now you can Implement these ads at any point during it it can be implemented at the start in the middle or at the end just before you go live it doesn't matter the process is still exactly the same but I do recommend making a backup before you start the process so first thing we're going to do is we're going to head on over to our the level play Knowledge Center so the MC plug-in integration it's in the description I have linked it and there we go so so the first or what we're going to do is we have to download the unity plugin for iron source which we're just going to click on there then if we drag and drop that into our platform like so it will ask us to import in this screen just here so we're going to click that import button just there it will then ask us to import a dependency resolver which has just come up here we're going to want to hit that import button now occasionally if you're on Windows you can get an error with this dependency manager which if it comes up I will show you how to do it alternatively if you do get a win32 error come up in your console there will be a video following this which will show you how to resolve it now if you do have issues throughout this integration chances are it's probably linked to the uh mobile dependency manager at and there'll be multiple ways to fix it which I which as you come across the issues and as I come across the issues I'll be creating videos to show you how to solve error so if you do get an error during this entire integration let me know in the comments and I will show you how to fix it so now that we have got the add mediation tab just up here which shows us that we have integrated in the ads mediation package we've got these four options what we're going to want to do is if we go into integration manager it will give us the option of all of the different adapters now today we're only going to be going over iron source and unity ads so whilst we're here we're just going to click install on that Unity ads section so now if we click X there whenever we make any any changes to this integration manager what would you need to do is we need to head on over to assets mobile dependency resolver Android resolver and then click that resolve button now if you do get this error saying the resolver is not enabled Android platform must be selected that is because if we go into our build settings we are not in our Android format which I'll switch over to right now fantastic so we know the fact is it is a switch server properly because it's now got the unity logo next to the Android bit just there so when we click X on here it does give us a warning this is an irrelevant warning as we are we're using SDK version 7.2.7 and it's just warning us that one of the unimpression success event is going to become obsolete in 7.3 so that arrow is irrelevant we don't need to worry about that one so now if we go back to assets mobile dependency resolver Android resolver and click that resolve button there we go so this is that win32 exception you may get this you may not but if you do I'll include a link into the into the description that um is a file we need for it so if we click on it we will see that it's asking for a gradle.back file but the system file cannot be specified so if we go over into our link just here which again will be in the description if you need it we'll head on over to our folder see this temp folder just here and then the Play services resolver Gradle now if you're not quite sure where it is you need to go back in our Unity editor it does say the path just here gradle.bat so in our photo we are going to create a new file they go into it so it opens up a notepad paste so this is the gradle.bat file that I have Linked In the description and we're just going to change this change the name of this to grader w dot bat now you know you've done it right if when you click yes it will come up saying the fact it might become unusable are you sure you want to tell you we're going to click yes on there so now when we go into here we're going to click x on it trying to resolve it for now I'm going to click clear head on back over to the properties right click and we're going to re-import now why brings this error up I don't know however it's quite a simple two minute fix and this is just a way to get around it for now fantastic so now when we click on assets mobile dependency resolver and then click on resolve for a second time you'll see in fact it is now working and it will come up with 100 success uh that it is working perfect so now that says the resolution has succeeded this will now um so the SDK now is implanted it it will work uh so if we was press play no no we've not actually linked to yep so iron Source have been kind enough to give us a demo scene so to get there in our main asset folder if we go to iron source and then click on demo seat we can load up an actual scene where it's already got everything already implemented and ready to go if we Press Play There we go so in the actual simulator when we click on the buttons you'll see the fact it doesn't actually will show us the ads which if you come over from Unity ads May confuse you slightly so the ads don't actually show within the simulator you'll need to test that on your actual device which I will do in just a moment to show you that this integration does work from this point so but the easiest way to go is if we go into our console we can see that the there is a valid integration just there it's been generated only Unity editor as opposed to a phone but it says fact the show rewarded button was clicked uh the it does say there's not a Video available but we'll check that in just a second and then we're going to see the fact we've clicked loaded buttons however this doesn't give us actual visual feedback so what I'm going to do I'm going to connect up my phone now and I will show you what is that you need to do and I will show you it working within the phone okay right so now that I've got my phone plugged in via USB to my computer what I'm just going to remotely do is install another package called Android logcat now a reason I'm going to install that one is just because it's a package that I'm familiar with and I get clear logs into what's going on behind the scenes so if there are any errors then I can you know attack it and adapt it then and there so I'm just going to install this package here uh build uh no we're not going to go into build settings and we just need to make sure that this scene is selected as our top scene we then click build and run go into temp so that's file name temp fantastic there we go so now that that has gone over to my phone we can see in here in the logcat which I draw it's up there so now then as things happen with him here we can very quickly chill in the I'd buy the log can't actually check out the errors if we get any now you'll see some errors just come up here which is all to do with the difference uh adapters now because we do not have them installed it's not going to cause any problem whatsoever within the app it's just notifying us that the these ones are not set up we've got the iron Source One all set up and we've also got the unity ad setup which is the two that we are most important about today and however though the app is loaded so let's check out by clicking the show rewarded video which as you can see just that it works so the rewarded our video does work then we're going to load the interstellar we're going to show that one again that one works absolutely fine so we'll skip that one then lastly but not least let's load the banner fantastic so if at this point the app does not so if at this point you are trying to do the uh the demo scene and you're not getting the at the at the ads come up then going back through the previous steps make sure that the uh dependency resolver resolves properly uh and if you're getting any other errors at all let me know in the comments and I will see what's going on and see what we can do to fix it but that shows us the fact the implementation works it's absolutely fine it's it's all it's all in in properly however that works on damage scene I wanted to work in what would be our app the actual main scene that we're working on which is this scene just here so I'll show everybody go into back into our build settings and just remove the demo scene and fantastic them so what we need to do now is actually enable the ads within the dashboard itself on iron source so before we do that what I am going to do is if we go over to our uh to our player settings so just go into product settings click on the services select your organization that is linked to your Unity dashboard create a project ID or link it to a previous one obviously if if you need to and then just fill out this very quickly fill out this Copa regulation which is well this out primarily primarily targeted children under the age of 13 yes or no we're just gonna go with no and then hit that save button perfecto so now when we go back into our Unity hub uh sorry I'll develop a dashboard hit that sign in button you'll see how many times I it's taken me to to be able to implement to learn how to implement I Unity level play so this is our game just here lp7-2-7 so we're going to load this one up here and we're going to hit that monetization ad section it's going to ask us if we want to get started we do we plan to use mediation which is which gives access to Unity level play we're then going to hit the next the next section on that one we're going to start refreshing this one to show you how to do it and then if your app is listed in the App Store then fill these out otherwise if the app is not on the App Store hit that buttons there and make sure you return to the store IDs after the project is finished and is published so let's click add project this is now going to give us our organization call our game IDs and also our show API key so we need to keep this screen up just for a second what we're going to do is we're just going to log in to the iron source should log into iron Source now if you haven't already learned I signed up to it then do sign up uh as soon as you sign up you'll be greeted with this winner just here which is to add a new app app store or Google Play URL it's not live in the application store yet uh the temporary name we're actually going to call this lp-7-2-7 and it's for the Android platform I will be going through iOS in another video as you do need to be on an iOS platform uh so if you're interested in that one let me know in the comments and I will link you to it as soon as it is up we're gonna go with a new setup and also again Copa regulations just needs to be your tree for this one if it is primarily directed Children or there is any part of the ad which appeals to Children you need to make sure you appear to the Copa America regulations for the sake of this we're just going to say General audience the app is not direct to children and then also make sure you fill in the correct U.S state privacy laws if that applies to you so I'm actually going to click the add app now and this is going to give us the Android key just here which I will show you what to do with that in just a moment so we're gonna activate the rewarded ad the interstellar and the banner this is the fourth option I said about earlier but as you can see you need to be approved in order some to have access to it I'm not currently approved I'm still waiting for that approval email but originally click that continue button fantastic so now it will be here so our LP 7-2-7 is here we've got the banner the interstellar and also the rewarded ads ready to go but it's not gonna work at this moment what we do need to do is head on down to SDK Networks click on the app in which we are dealing with now today I'm going to be showing you about Unity ads and iron sword I'm not going to be taking you through ad Colony or direct deals I've just been playing around with different mediation um companies just ready to create some more videos on it so what we're going to want to do is if you click this manage networks just up at the top here yours will not be in blue you will have iron sourcing blue that'll probably be it but we're going to want to add our Unity ads so if we click on Unity ads it's going to ask us for API key and our organization core ID so this is why I said to keep this screen as here we've got our organization call and we've also got our API key just here which just needs to copy these two into the relevant boxes in here API key here and the organizational cord just here so now when we press save here we can also just click finish project setup on here then it's going to give us the welcome thing which we can dismiss then if we go into placements down here we can then go into grab our Android game ID and go back to our iron Source SDK network setup where it says non-bidding you will now have the Android ads here when you press set up in the corner here it's going to ask you to set up each of your difference rewarded in sterile and also Banner so yep so once we put in the game ID just here which is relevant to Android which is that one just there obviously if you're doing the iOS version it'll be the iOS game ID just in there now when you go to the different tabs here you've got rewarded Interstellar and banner and then it asks you if your placement ID so this is just under placements here why I said for us to go into placements because we get all of our uh placement ideas just here so we've got the inter sterile just there where we're going to go into iron source add that in there save we're also going to go and add our rewarded and also our Banner at the same time now you can add in your mediation groups so if you've got different groups you want to Target particular countries then you can obviously adapt that in just here that is under mediation just here the mediation manager so this right at the bottom here is use only to prioritize the instance as a new waterfall however it is completely optional but if it's anything like the unity ads of mediation it's just setting the floor price off the adverb so we're going to click save here we've now got as you can see it they've turned to Blue now that means the fact that they are all active we've also got iron Source up here also in all blue now if we go over to edit Network on here because we do want it to come into test mode we just need to click on test mode test mode and also the banner into test mode just there fantastic so now if we go back to SDK networks right then so now the dashboard is all set up we can see the fact that the networks go we've got a test module there and we've also got Unity ads all linked up there is one more thing we need to do when it comes to getting it ready for the code and the Android development side what we're going to want to do is make it be able to Target API 31 for Android so to do that if we go back to our plugin integration we're going to be going into this sections here step four first off we need to declare a Google Play services normal permission into the Manifest file it as follows so this user permissions section if we go over back over to our project so now we're here if we go over to edit click on Project settings and head on over to custom main manifest check that now this path just here assets plugins Android Android manifest we're going to want to load that up so if we go into assets assets plugins Android Android manifest load that up then in here just underneath where so between where it's manifest ends and application begins we're just going to want to Chuck that right there thank you so now if we click X on that that is the permissions setup now and if your Unity is in the unity editor 2020 upwards uh then we're going to want to add this into our Gradle properties which if we go back to our places here it is the greater properties template open that one foreign ties I'm gonna just open that up with Notepad where we can now just paste that in just so X on there X in there again we'll then close this then one last time we'll just resolve the dependency if there are any issues with that installation then it would become apparent there so now that's it that is US ready to get into the actual code and initialize the SDK within our scene we've done everything else behind the scenes it works we know it works and it's pretty much ready just for the actual coded initialization so to get started we're going to create a script folder and call it whatever you'd like I'm going to call it iron uh so we'll put level play uh we'll call it that I'm going to want to whack on onto something which loads in at the start scripts cannot be found it's because I'm still waiting for the script to be made five thousand right it's another script actually has been created now if we used to drag that into there there we go level play ads we're just going to open this up in our design editor which is linked to our Unity whilst that loads up I'm just gonna head back over to our uh documentation from the knowledge Center so we've done all the way up to step uh four now step five we don't have to implement because that is a manual integration which we are not doing so now we move on to step six to initialize the ad units so this is the initialization step where we have to do these bits just here prior to then setting up the rewarded the interstellar and also the banners so let's get started we just want to copy this on application port thank you whack that in just underneath here whilst we're in here I am just going to create a quick comment and we'll do a banner call back adding these two colors just this all makes sense a little bit later on I'm gonna Zoom that in a little bit more like so for you so we don't need this update function just here but we are gonna need to start one so if we go back here uh the you sorry you have two ways of calling the because essentially calling your dashboard we've got the one method where you individually call is uh just rewarded and sell the offer or banner and these can all be called separately so if you're uh app only needs the banner then only call in the banner or if you're only running rewarded videos then only calling them rewarded same goes if you're going to startle however just for ease of this I am just going to whack in the alternative we're just calling them all in at once so we're going to work that one here now where it says your app key just here this is where we're gonna go back to our dashboard our app key just up here which is in the SDK networks or if you go to your dashboard here Android app key so we copy that paste that into the start function just there we go back to our documentation it will then say the fact that there is a listener just here which is to tell you that it is completed so we're going to whack that on a private uh void we're gonna do this on an on enable function and we're just going to copy that private void into a wax down here now this is if so this is a callback function where this will tell us that the SDK is initialization it has initialized it's completed so in this sense it's so in this in this instance if you're running banner ads this is where I personally would actually load the banner and have it come up on the app however though we're going to be linking all that to a button so we can control load it and destroy it as it comes but we're going to get onto banner ads in just a second so next up we're then going to want to verify our integration so if we whack that just underneath here I need to start you don't necessarily need this one but it is useful for showing in your code that it does in fact that it is verified and it is working um then that is essentially everything we have done for the script and that this will now be initialized this will now work so if we press play on this function just here we will then get generated with the unit Unity editor which is correct we've generated code with the unity editor and it's fantastic we have now have we haven't got any errors so it will work when we move over to our mobile when we initialize the banner and everything else so that's the code needed to initialize it now we want to actually add in the banner ads so to get started on there on here where it says no what's next we're going to click on Banner essay I'm going to give us all of the steps and also all of the useful things about banners so very quickly I know in the previous video I did with UNC as mediation a lot of people commented on how can you change the banner sizes well it's literally here so uh which is also quite useful otherwise you can actually increase you can actually add your own Banner size so you can actually reposition it to fit within your app depending on the on the space you've got for the banner which is also very useful and then also planning positions you've got top and you've got bottom you can then also hide the banner and also display it so if you do hide it you just want to want to call the display Banner rather than reloading the advert again so how do we actually implement it if we go over to our step one and actually load it in I'm gonna copy that and here I'm going to create a function just here which is going to be I'm not going to do a public one public void load Banner and we're just going to whack that in there so this function here is going to be where we load the banner in we're going to link this up to the button in just a minute within our scene that load Banner button just up there but whilst we're here we are also going to add in all of the banner events so you've got all of these Banner Adventures here which does say to add it into the void start but I'm going to add it into the on enable so just copy these events like so we're going to work that on the on enable scripts just so we are going to get a load of red squiggly irons underneath that because this section is here is where all the callbacks are going to happen so I'm going to this where why I added in Banner callbacks so I'm going to copy that in so we can actually like when when a banner ad is loaded then we can do something again if it's failed we can put the error into a log and obviously when it comes to figuring out why something isn't working we can obviously find that out so however though for us uh for this we don't actually need to do anything of that yet and if we scroll on down we've also got the ad info ones which just makes it a little bit easier if you've got all of them and we're just going to copy that one and to the bottom here based on it so now the now the banners the banner will load it will load and it and it will work but we're going to want to also Implement a destroy uh destroy Banner for the button as well which is gonna be uh iron source dot agents.dist destroy Banner there we go fantastic so now all this left to do when it comes to the banner integration is just to link these up to the buttons so in here if we go over to our load Banner we're going to create a on click event which we're just going to drag in the section where it's got the script added in my case it's the main camera I'm going to click on no Funk on sorry on the no function drop down banner and then click on load Banner which is the script we created just a minute ago this one is here so we're going to do the same for just underneath it for the dispose Banner where we're going to create another Scripts sorry another on click event which is going to have the destroy Banner function so now when we click file and rebuild it to our phone fantastic and so now that the app is loaded we click load a banner the banner is loaded as you can see at the bottom just there now if we also click dispose Banner it destroys it so now we know the fact that the the banner works the integration also clearly works because we were able to get a banner loaded up so now that is the banner integration all done or dusted Happy Days let's move on to the interstellar so it is a very very similar process if we go back over to our code we're going to eventually comment that as uh but uh buttons create Windows 7z4 size but says and whilst I'm here actually create another one for rewarded perfect right so now that that's done if we scroll down to the bottom go on over into the interstell it's a very similar process we just need to when it comes to all enable we're going to want to call the Callback functions again write those in on on enable at the bottom like so I've got a full set of ads just there scroll on down the add info now these are not necessary as I said in the banners um however they are useful for when it comes to the debugging or you want more information relating to uh you want more stuff to be able to do whilst the Banners are running or vice versa so they are handy they are handy to have better to have them and then use them later on then if you don't need it if you don't have them then you implement them later on it'll be easier just load them in now and now we've got the load Interstellar which we're going to add into a button function which is just here so we're going to do public avoid I'm really going to call that load all right now this one requires a separate function to actually show the advert uh show for size add so now we're going to need to show it should we scroll on down show into sterile which before we do we're gonna we're gonna do an if statement actually we're gonna if we're gonna create an if statements make sure that the ad is actually there when it ready to play which you could do Implement some sort of thing on the in on the interstellar add ready event but we're going to do it this way we're going to do iron source dot agent dot is into style already and then if it is we're gonna show it otherwise we are just going to put in a debug.log event and not ready and plastic and that is all we need to do for the interstellar uh section as well and then before we actually do load it we do just need to make sure that the button is actually linked up to our script so if we go to the button hit click on the add to add a function so we're then going to go on load load full size add there we go and then we're also going to want to create one for the show so we're going to be show full size ad there we go so now if we go to file build and run foreign save the scene and that's then so we've got the mode of unity perfect right so now when we press load full size add that should now load in the ad and now when we click show Fantastic look at that we get the adverb it works absolutely fantastic so the last one to really move on to now is just rewarded the full size rewarded advert so now we're moving on to the last one which is the show rewarded ad down here so again what we're going to do in here is we're just going to go up back up to our button sections and just create a public void which is going to be sure well sorry no rewarded reward dude add fantastic if we go back over to our knowledge Center we go back down to the bottom and we click the rewarded video it is pretty much the same story again if we copy the callbacks copy those into the unenabled I'm going to write these at the bottom just so again you only need them if you're planning on doing more stuff but the rewarded ones there is at least one which you're going to need which is it might be in this one's here video like a rewarded video rewarded event so this one here is one you 100 need to keep because this one's the one where we can add the add the rewards of the user so I'm just gonna copy in these Advanced on that one so also the info ones just at the bottom here let's go all the way back up to the top potassium okay that's our sense no issues found that's good that is pretty much ready to go so if we go back to our Unity script now over to our button show rewarded ads we're then just going to create another click event put that over here on the function level play ads we're then going to click on show rewarded ad and that is pretty much all we've got to do aside from we need to actually reward the user once it is complete so if we go back down to where it was there we go I'm going to do a debug.log uh we're just gonna make this stand out reward player so this will just show up in the console but okay then so now that we've got the debug here that will come up in our debugging software so I used Android log cap so that will come up there to say that we there will be rewarding the player but I wanted to very quickly just add something into the scene to be able to demonstrate to you guys that it does work so I'm going to very quickly select my score text which is just up here and I'm just going to do a very quick function here so we're going to do game object Dot find we're going to whack in score text dot get component we're gonna need to call in the text mesh Pro you going dot text equals and then we can do score a thousand that function could be a lot better um however though just for the just for Simplicity of showing you this would resemble the uh the reward right and so now that we've added this text in just here there is one last thing we need to do before we load it into the app and that is go back to our our rewarded button script and we need to add in this functions here which is show rewarded video but what I'm going to do just like I did with the full size ad is we're going to make sure that there is in fact one available first so that is going to be an if statement with iron source dot agents.is rewarded Video available if it is we're going to show it otherwise we're going to do a debug .log and we're going to go on there and say reward video knots away so now then if we go to file build and run hit that save button save again fantastic so now when we hit that show rewarded ads we have a rewarded advert now when we play all the way to the end so I can show you it update that score to score a thousand there we go so score a thousand if this video has helped you please do consider hitting that subscribe button that notification button and also giving us a thumbs up now we're creating more videos on monetizing your game so finally figuring out different ways to help get that little bit of extra Revenue out of your game and yeah I look forward to seeing you in the next video so
Info
Channel: Jack Harris
Views: 19,607
Rating: undefined out of 5
Keywords: unity, unityads, unitymonetization, unityrevenue, unitygamedev
Id: SBtfuWEN5qk
Channel Id: undefined
Length: 44min 5sec (2645 seconds)
Published: Sat Jan 21 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.