 Hello guys Cryptocrowns here welcome back to another Unity video today I'm going to be showing you how to get your game to fit on different screen sizes Anyways, if you learned something new if you enjoyed this video make sure you smash a like button comment all your feedback suggestions Complements all that good stuff below and subscribe to my channel if you're new and turn on notifications for future live streams and videos Anyways, let's hop into it. So here I have set up a canvas with an image a button and some text So I'm going to be using anchors in order to get this to fit on different screen devices Currently it won't do that properly Okay, so right now only the background fits on 720p So in this video, I'm going to be showing you how to fix these kind of problems, right? So let's start the background since that's our main issue here So as you could tell is that if we change our resolution the background is Our image here is just in place right here. If we go to free aspect here. You can see that it like Stays in place. Okay so if we go back to 720p what we can do here is change this anchor right here in the rec transform components inside our game object You can change this from the center position to the stretch The stretch anchor right here So now this one right here will stretch only from the top So if we set it to this one, for example, and we change the resolution You'll see that only stretches from the width not its height So if you change it to this you can see how it's only stretching to this right here to the top and you can see that by looking at this at its anchor points right here, okay? So now if we go back I want it to stretch the entire canvas, right? So we do here is click on this right here the stretch on both All directions right here now you can see that the anchor points right here are at all four corners Okay, so now if we change the size of this the resolution of this or device the screen size, I guess It will now stretch with the canvas right here. Okay, so we have problem one solved. I'm gonna make this a little darker Okay, so now the next issue is that our Button and our text are kind of in an awkward position right now Okay, so for here we want our coins text to be at the top for example, okay So what we do here is that we change the center anchor to the top center right here So now you can also set stuff to the corner too. Let's I'll show you an example here So I'm gonna create another text by right-clicking on canvas go to UI and text for example We can use team TMP text. It's the same thing But just for For an example here Let's just put like, I don't know version Let's say we want our version to be on the top corner. Okay At least the size of this so what we could do here It's just place it in this corner right here. Okay the corner of our canvas here Now the issue here is that if we again change your resolution, it'll be all out of the canvas We'll be able to see it. So now what we do here is that let's say we want to anchor it to the middle here Okay, so now it will only be anchor to the left but not the top So now it will still show up above our canvas if we change the resolution like that Okay, if we also change it to 4k, it'll be lower than what we want it to be. Okay So now let's go back to our original two four three six five eleven twenty five Now let's anchor it to the top left corner. Okay, so now if we change the resolution It will move with it. Okay Now you could obviously Make things smaller if you want to because this is probably a little too big. Okay, just for an example though All right, we have one more thing we need to fix is this button right here So let's say we just have a giant button on the side, I guess Just for example, it could be a panel. It could be anything. Let's just say we have this on the side Now if we anchor this to the side for the most part, it will work out Okay, see it looks just fine However, once we get to the 720p, it looks kind of bad, right? And this is obviously not gonna work out for us So now what we can do here is Stretch to the right side. Okay, we click this one right here Okay, so now if we change our resolution to 720p it now stretches here We have one more issue and this is a tricky one Now this one if we go back here, let's say we want to keep it in this corner right here We want to set this to Stretch right here. We want to stretch on all corners now the issue with this one here is that We can become negative right here. The size is now negative, right? So if we just move it around you can see that finally shows up here But this is negative so we see that red X. Okay, so to fix that We go back here. Okay, get rid of the stretch inquiry and go back to a smaller resolution Also, that's why I like to prioritize for mobile gaming or mobile dev Especially I like to pry I like to do this resolution because it's the skinniest resolution possible so I like to benefit my smaller devices and Then focus on the bigger ones after that. So let's go to 720p for here Now what we can do here is readjust this button here to what we want. Let's just say we want it here, okay And readjust this text to make it not looking out so bad Okay, so now what we can do here is that we can reapply this stretch anchoring right here and now when we change the resolution to 2436 by 1125 it'll look like this. It's still not as good Okay, I think for this one we might have to do this the right anchoring. Let's see. Let's see. Okay looks a little better So it's just something you got to play around with right it's not the easiest task You can also Move these right here. So let's say you wanted to not come past this coins text So you can just drag this right here this knob right here and you now have a custom Anchoring system here. So now if we change the resolution you can see that the button is not bigger But it's also staying within this boundary here, which is very nice what we can also do is Keep it in this area if you want to but now things will start looking kind of weird But that depends on what you do here. So again, you can adjust this knob to whatever you'd like So let's say you want it even closer You see it doesn't go past this anchoring this anchor right here, which is very nice and very helpful And it'll help you adjust to where you want things to be in the game All right So I hope this is helpful if you learned something new make sure you smash that like button subscribe my channel If you're new comment all your feedback and all that good stuff below if you have any suggestions for future video Well, let me know below and I'll be sure to consider them anyways. Thank you very much for watching Have a good day or night. Peace