 What is up crypto grounds here? Welcome back to another video. Welcome back to the idle game tutorial series is episode 14 I am very sorry. I've been publishing again. I got really busy and now that's corona time. I Got more time to record some videos. I'm just very busy with my own game right now So very sorry about that price also my live streams I've been doing lots of development lately and playing some games because I've never really got to do that in my own free time Before this whole mess anyways, hope you guys are all doing well and let's take safe through in this Strange strange events. All right. Um, so Today's a little different someone commented below earlier that I should do ads Like well, I mean he suggested it So why not do it now before I forget it because I was planning to do this at some point But I just feel like I'm gonna forget to do it so I might as well just get that out of the way, okay So before we get started, we are going to use AdMob My Google it is better than unity ads unity ads suck ass They're not very good. They have a really they don't I don't really like their Their CPM. It's very low compared to AdMob and They're a lot easier to manage It's a little harder to set up though, but it's easier to manage in the long run So we're gonna stick to that. Okay. So first of all, we are going to need to make an AdMob account Okay, so here's mine right here. I'm not gonna show any of my stuff because that's personal information But yeah, you'll see a blank screen once you make an account So what you're gonna want to do is you want to go to apps right here and you're gonna want to do ad app And remember this is when you have either this is when you're actually ready to set this up So remember it's best to wait when you're starting to test the game Okay So have you published your game on the Google player app store? Let's say in our situation. We have it yet So we're gonna put no So then we're gonna fill in our information. So this is gonna be our idle game tutorial series All right, we're just gonna put an Android. We're not gonna actually upload this But I'm just gonna kind of show you what you need to do So we're gonna put this here. We're gonna click add It's cuz it once we're done. We will have to Set this up later on so you're gonna see an ad ID or your app App ID. Okay. This this will stay with you once you Up with the game. I think it won't change. I think I'll always do the same But just yeah, make sure you have a name the same name as when you publish the game, okay? All right, so we're gonna do we need to create some ad units, okay? So we're gonna create one or two create ad unit And I'm only showing you how to do rewarded ads because I've never done banner or Interestational which is where it's such a pop-up ad I've never never done a native advance I have no idea what it does. So don't ask me to tutorials on these other things I've never used them before so we're just gonna do rewarded ads since they're the probably the best option you can get So create a name whatever you want. I'm just gonna do add one You can Do whatever you want here for the word settings. I never do this myself Because I can manually control my own rewards. That's how I do for crypto clickers is I never mess with this I actually do the reward stuff inside the code. So Advanced settings now so you have ad type. Just leave this is not good Frequency capping. You don't want to do that Or else you'll be limited on your ad watching ECPM floor so now what I do. I'm not gonna know what I do. I have a cpm floor I usually set it for 10, but it's not really the best method of doing it So I would just set it to around 5 ish Or just experiment with it or just have no ECPM floors as well Basically, if you don't have a floor you'll get ads pretty much instantly because there's tons of ads out there Ready to be fish, but if you have like 10 or 50 Ads are gonna come in really slowly like if you put 200 you'll probably never get an ad because no one's gonna put an ad Where where he spends $20 only 10 people are gonna watch it. No one's gonna do that So that's why we have this is disabled. So we're gonna create ad units So we have our app ID here and we have our ad Unit ID. Okay, two different things how you can tell the difference is the squiggly line here and The slash the slash is for the ad unit. Okay So we're gonna do We're gonna we're gonna create that manager actually before we do that. Let me load up my game real quick so This is your own tears that I'm working on I need to grab Okay, so let me find this real quick You're gonna go to this one with all the lowercase. So go here. We're gonna download Download zip and we're gonna do this all over again so that sucks because we have a Whole dang package on unity Scripts admin. Okay. Um, okay. So we have our zip file here if you get another folder Right here Okay, so what we do is just drag this folder into our project Okay, so I guess we had to open up the assets folder and explore first okay, so just Drag this in here and your assets make sure it's in your assets not in your Main folder else is not gonna be there. I don't remember this being so complicated And hopefully hopefully work So pay close attention. There's gonna be a few things we're gonna need to do Set up twice you cannot miss a step do not skip to the very end of this video This is one of these videos where you cannot skip to the very end people tend to do that my videos When they run into issues, then you cannot skip parts of videos and expect not to miss one thing because I'm pretty straightforward Well, like when I type in code sure you skip that but you most likely gonna miss something important if you do that This does not look very familiar, but we'll use it. Okay. Oh Boy, I'm already stuck on this. Okay. Stop Okay, we're gonna be using Google there we go dot API. That's more like it All right. So now we're gonna type public rewarded Okay, so name this rewarded add for now. It should be good. All right We are going to create a public void start method and in here. We're going to do We're gonna create and we're gonna create a different if statements So this is So I chose Android right so we're just gonna do if unity Android because this isn't this is specifically This ad unit ID is specifically for Android. Okay, we're gonna create string called app ID equals our Oh, yeah app ID, correct. So make sure to slap the dash. It's the squiggly line one. Okay So make sure it's This top one right here. Okay, so copy your app ID and put it right here. Okay And then we can do the same for if L if unity iPhone string App ID again pay close attention because you're probably not listening right now but We don't work. This is this is specifically not for iOS So we don't have an IO and or an iPhone So we're just gonna do unexpected Platform so we will not get any ads for iOS because we didn't simply set it up for them, right? And then we're gonna do else Unexpected platform so if it's like a computer or something like that and then Hashtag and if That's it All right Next up we are going to call mobile ads dots initialize we need to initialize our app ID So we will just paste app ID in here and What I tend to do this is good from loading ads in the background But we are going to set iOS pause app in the back Set iOS app pause on background false It's because it will keep using our Wi-Fi right and plus where there's no reason to check for ads No, no pause them back. Yeah, sorry. I can't confuse there and I said it's false It's what I did. You don't have to this won't affect anything with Android So, you know what actually just ignore this my bad All right, so This is it for the start. Let's see Okay Next we're gonna do We are going to type rewarded dot rewarded ad on ad fail to load And we're gonna create some methods here later on and then we're gonna type handle handle Add fail to load. It has to specifically be this name in order for this Google mop mobile ads API to recognize it. Okay It's it should look like this handle reward ad fail to load. Okay We're gonna do this for the rest of the stuff that we're going to need on ad failed to show And copy paste this replace it with a show Worded ad on user earned reward. This is how you grant the reward and we're gonna do handle User earned reward and these are gonna be methods that we're using eventually. Okay And then we're gonna actually create this request at first so we can start loading ads right away. Okay, so add request quest Is equal to new ad requests? We are creating a new ad request object. Okay? Ad request is the object Builder dot build So if you want to test check out their API just search up Google AdMob unity API And you'll find some stuff. No, I can show you how to test ads without getting punished for it because if you Watch ads on your own address On your like not address your own device. It will somehow Google figures out Somehow they figure it out and they will punish you for that my taking away some of your earnings Okay, and that can get you in trouble and eventually lead you to termination So do not farm ads. You can't it doesn't work that way if you're not listening Listen up. Do not farm your own ads. You will get terminated It doesn't work. You're not gonna get a sense out of it They're gonna find out and they're not gonna get you anything and they could ban you too. So then we're gonna return We're good Okay, that's it for our start We have some red we'll get there Okay, so I'm gonna import a method that I have for this, okay, we're gonna modify it We're gonna start with the ad failed to load All right, so here it is. So we're gonna mess around with this We're gonna create an in real quick public int times failed And this will be used to kind of just calm down the requests because if you because it just lags your device if you're searching every Like if you do it public would update and you do this constantly your game is unplayable All right, so we're gonna create a little this is our little like delay system here Okay, so here we are going to So what I'm gonna do now is I'm gonna create a new method called create and Unload rewarded add All right, so I'm gonna move this stuff down here All right. All right, and then down here. I'm gonna type rewarded Sorry, if it's you're not following along Just make sure you're listening to me and then understand the punishments for not doing this correctly and performing ads Just at least make sure you understand that So we're going to do equals forward add equals new or did add And we're gonna put our app we're gonna put our Our ad unit ID in here. Okay Just put that in here And you're good to go so in here We're gonna do something called invoke which basically it it calls a method in 10 seconds 30 seconds 60 seconds two minutes So on okay Yes, two minutes four minutes, and you can just add however you want. Okay, so instead of this right here We are going to replace it with Matt okay This will call This method add delay Okay, instead of creating an I enumerator and creating a delay that way It's better to do it invoke because it's just an easier one line thing. All right Next fail to show So this one's just pretty self-explanatory because it's not big deal if it fails to show that's most likely You lost internet Okay, so we're gonna do public void and awarded add bail to show Okay, and in here we need to put object sender Even though we never use these we still need to have these included in order to be detected from API That's just how it is Okay, that's because when we call these it's gonna automatically have a send it's gonna have these two So if they don't exist, we're gonna get a bunch of errors. Okay, so make sure you do have these even though You're not using them. Okay Because that's how we call these methods on the back end from their API All right in here We're simply just gonna do Create and load a new add That is it All right, and now we need to get to the reward part of it So create a new method public void handle user or earned reward and here we're gonna put object sender and reward Args Okay So we're gonna hop back to here real quick So we're gonna click done And see you have your ad units right here, right? So I'm gonna click on here real quick. We're gonna edit it So we're gonna edit the reward settings So we're just gonna do rewards from this because this is where our reward comes from Okay, so what we'll do here. We're gonna edit this reward now. We're gonna say We can't test these on videos. Okay, you can't test these But let's just say a hundred. What do we do here coins? Coins All right, we're gonna save it So our reward for this ad is a hundred coins for example And if you want to do like a two times boost for an hour, then I'd suggest you to watch my I think it's the third episode of The clicker heroes because I kind of showed how to do something like that where you just get like Five minutes worth of coins, you know, it would just be that same thing Like where you could put a hundred coins in here and you can check if reward if Or you really don't need like this if you're gonna do that because we can do here It's just apply the boost in here, you know, this is useless. Okay, but in here what we're gonna do is We are going to Okay, so we're gonna get our public idle tutorial game, we're gonna put game in here at the very top And in here we're gonna put game data because we are referring to here Coins plus equal arcs. That's our reward. That's it. Okay Okay, so what we need to do now is that we need to convert this to big Okay, so how this works is that we have this 100 coins here, right? So here Arx has two Variables inside it it has dot type and it has dot amount Type is right here the enter reward item. So our type is coins and our amount is the 100 so we're gonna do args dot 100 dot amounts and This will convert to our big double here and it'll work. Okay So then once we're done here, we're gonna create a new ad All right, so we just copy and paste this method here We are good to go now. Now you again, you can just do whatever you want here. This is basically your reward In here is create the ad again. Okay? So basically we are creating ad Whenever it fails to load whenever we can't find one technically When it doesn't play correctly. So when we lose internet is my base was like like the big the biggest known reason in my opinion and when we Earn reward now, there's tons more. So if we go to this sample script here, we have Handle rewarded add a close. So if we get out of the ad we can display a pop-up that you won You can do that But make sure when you add these you got to do it here. Okay? Yeah, that should be it honestly for this part. Oh, right the most important part We got to actually show the ad. Okay? So we're gonna add an update Public void date So now again, we can't test this Ourselves we just got to trust that this works. Okay? If it doesn't you guys can literally scream at me and be like, ah, it doesn't work. It doesn't work All right, and then I'll make a follow-up video how to fix it Okay, so we're gonna add a button a public button Frick add button Watch add Right. We got to add using unity engine dot UI Also, the other things during this in the middle of the video just in case you guys some some of you guys are not like listening I'm not gonna show this code at the very end Specifically because I want you to watch this whole thing and if you're still skipping it Please go back to the very beginning and watch the whole thing Okay, I really don't like when people skip my videos because they ask for what's wrong. What's wrong? Why is it's not working? It's like well you skip my video. I explained it clearly how to do it at this time I know that can be long and tedious, but if you want to learn you got to watch it You got to do the work but in the time anyways back on track Okay, so anyways, we're gonna make an if statements called rewarded add shoot rewarded add Dot is loaded equals true But we can make this shorter. Just keep it as that. So if it's true Oh, right. This is a method. So if it's true This button will be enabled dot game object Dot game objects dot set active I can type true Okay, otherwise It's false Easy as that It's easy, right? Okay, next we're going to create another method the very bottom here Public void watch add Okay, so we want to check again if that is loaded and just in case of some glitch happens So if rewarded add Is loaded Okay, we're gonna do worded add dot load add and actually Why is this not working? Oh Right, duh Okay, we're gonna put in here rewarded Warded add dot request. Oh, I said not working. I see why it's not show Duh and We're going to turn off that button. So that watch add Dot game object that set active False. It's not correct. Yep. So now what you can do here is that we can add our rewarded So we're gonna add that real quick public game object Dot Ward pop up and I'll start before I forget we're gonna make sure this is off That game object dot game object dot set active Okay, and we're gonna make this true And we're gonna make one last method public Void close add Ward Okay, and this is simply just to make this false All right, so here's our entire script So make sure you paid good attention Make sure you check your capitalization a lot of people have been having issues with that lately. I'm just like Yeah, that's it Should be good to go So we can't test this we just gotta trust that it works So in here, we're gonna create a game object called add manager Move that to the top. We're gonna add our add manager script Move drag our game manager to here And now we need to make our buttons. So we're gonna put in the header And I'd highly suggest you to use small buttons that show up like right here Okay, not big pop-ups because people hate those and people will hate you for life if you do that So we're just gonna put I guess we need one of these And a dark background So I'd suggest a better place for this but I'm just gonna put it here for now watch add And we're gonna put a button here Create new on click drag add. No drag your Add manager here. Not your game manager. You're add manager. No function add manager And Watch add okay I'm gonna put a text in here too Now I'd I'd I'd suggest you have a better, you know looking text in this, but we're just we're just gonna roll with it Watch add So yeah, do whatever you want there be unique Creative and then our admin manager. We have our button Okay, also one more thing if you want to hide this for people who aren't Playing on mobile so on the phone like on a computer Computer, I'm sorry. I forgot to say this way. This is only for mobile. Okay. We could put this in here if Android and unity iPhone or You can have it Android only so we're just actually so this is for mobile So I'm just gonna keep the iPhone in here, even though we're technically not doing iPhone right now else We were just gonna completely have the button disabled and if okay, so basically if it's Android I Apologies if it's Android or iPhone Okay, so make sure you have the double bars It will run this Otherwise the button is completely disabled for any other operate operating system If you're doing Android only then just do if you need the Android and then we're good to go. Okay Save that And now we need to have a little reward screen Come on, you needy you can import a little faster than that. I'm gonna create an empty Board add Name whatever you want. We're gonna image. Nope. Nope. Nope. Nope. Image. We're gonna create an image just to give it some decoration Let's do this one and let's have a light green to it Of course make it look more pretty than mine, but This will do like usually in the middle of the screens, okay This is fine Okay, so here we are going to do text Thanks for watching the ad You get 100 coins Simple as that text that Big a little bigger and then we're gonna have a button close And then we're gonna Do the same thing drag game manager to the button and do Close close close. Where are you close? My my stupid. Oh, I did game manager ad manager And then close ad reward and that will work So anyways, I can't test this because none of this will show up because we're on computer And I really don't want to build this Except to create a ton of stuff in order to get it working for Android. So I really don't want to do that Anyways, I hope that was helpful. Do you want to test this? And I would watch I would suggest you to watch another tutorial on how to build this for Android Because I I have at least like 10 videos to make for the series and I'm very very behind So that's my last priority So I need to do those 10 first and then we'll get there. Okay Anyways, I hope that was helpful Save your project and hopefully that works anyways. Thank you for watching even in questions comment down below Add me on discord join my discord. I'm trying to get my server verified so I can easy to say join discord I do do you slash crypto grounds now to make things easier But what's not happening right now? Anyways, I'll keep you guys updated. Thank you so much for watching Hopefully you watched all of it and did not skip any parts of the video Cuz I highly suggest you to watch the entire thing in the whole entire series too. Anyways Anyways, have fun with this. Have a great day. Thank you for watching. Peace