 Okay, so let's keep on going with our rename object tool. And the first thing I want to do is I want to detect if the user has gone and selected a certain amount of items. And I want to display that certain amount of items inside of this window here. Alright, so let's go into our ongoing method here. And what I want to do is I want to assign an array of objects. Okay, so that means I'm going to need an array of game objects. Okay, so up here in the variables, actually, I'm going to add a new array and I'm just going to call this selected, like so. Alright, and we can always initialize that as well. So we can say new game object of ray 0, like so. Okay, and I'm going to come down here into the ongoing and I'm going to say selected is equal to selection.gameObjects. And the reason why that works is because this particular property, alright, this C sharp property is returning to us an array of game objects. Alright, so what we can do with that is we can now then display that inside of our label field up here. So I can say something like this, we can say selected then colon. And then I can concatenate so that just means we're going to add on a string by using the plus symbol there. Alright, so we're going to say selected.toString and let's just keep it to a format here. So we'll say 0, 0, 0 like that. Alright, that's how we go and format our string. And what we need to actually do is get the length of this array because this is an array object here. So I'm going to say dot length, that's the length of the array. That's how many game objects we have stored inside of this array. And so that is what I want to display. So I'm going to say selected and then the amount of objects that we have selected. Okay, so we save that and go back into Unity here and let's test this out now. We could test that out with just these two game objects, the default, the directional light and the main camera. Alright, so now I have my editor window here and if I start selecting stuff, you'll notice that it's not updating. And that's no good because you can see that when I come and actually focus the window it'll tell us how much game objects I have selected here. But I really want that to update in real time. The reason why it's not updating in real time is because we actually need to repaint the UI all the time. Alright, so this repaint method right here will actually update that UI for us in real time. Alright, so it just updates it as we're selecting stuff. Alright, so let's test this out now and you can see now we're getting an update all the time. So in real time I select something that's updating. Just that simple. We can just utilize that repaint method. Cool. Alright, so the next thing I want to do is I'm going to just make those guys a little bit more neat like so. And we can even go and add some comments. So we'll just say get current selected objects just to be professional about this. And then what we'll do is we'll say we'll display our user UI. Something like that for now. Alright, so what I want to do is I actually want to give the user of this tool the ability to change the prefix, the actual name of the object, and the suffix. And I want them to have the ability to add a numbering to it if they choose or not. So to do that what I'm going to do up here in the variables is add a new string that is called the current prefix or actually it's called wanted prefix. We'll do that. So wanted prefix and then we'll do string wanted name. Alright, so it's a name that we actually want to give our objects. And then we'll do string wanted suffix like so. And then finally we're going to do a boolean okay it's a bool and we'll say add for the boolean name, the variable name there. And that'll just allow us to add on at the very end of the string some numbering to it. And what we're going to do in this video is make it relatively simple and basic. And once you you've gone and watched these videos and you've created your own, you're obviously more than welcome to go and add whatever you want. So I definitely encourage you to go in and customize it as you see fit for your particular project or your needs. So what I want to do now is I want to actually put all those guys into the UI. So the easiest way to do that in this case is let's do the wanted prefix first. We're going to say wanted prefix is equal to an editor GUI layout item. And this item is going to be a text field alright. And let's take a look at the arguments for that. So the arguments that we get for the first one is string text. So that's going to be our wanted prefix. That's the text that we want to populate with the value that the user inputs. Alright, so let's go down one. And we have this GUI content just like what we did up here at the window. We can assign a GUI content to this and then the string and then some parameters. And then we have string text and a GUI style. So this is when you want to customize it to your own style. And then we also have the one that I usually use, which is just the string label. And that's the label that will sit in front of the text field. And then we have the string that we want to update. And then we have the parameters. Okay, so for the label what I want to do is just call this prefix. And then put a call in there in a space. And then for the string, the string that we want to update is that wanted prefix variable. And then actually let's just start there. Because that should work right off the bat. So let's come back into Unity over here and take a look. So let's just take a look and see what we get up here. Alright, so now we have a text field and we can type stuff into it. Alright, there we go. Cool. So let's go and actually add the rest since we're at it. And what we can do is we can actually just copy this here. Alright. And we can say the wanted name. Alright, so this just makes it real easy here. Is equal to that name that we want to input. And we have the wanted suffix. Alright, so we'll say wanted suffix is equal to this. It's that one more time. Looks like I copied it wrong there. Alright, so we'll do copy, paste. There we go. And then we want to do suffix. Like so. Cool. Alright, so let's go and take a look at that. Jump up here. Let that compile and we'll update our window here. And now what I want to do is I want to actually provide this a little bit of styling as well. You know, to get things rolling and testing you could just do that for sure. That's obviously totally valid. But I want to start diving into some you know, more of the styling side of stuff here. So let's just do some really simple stuff. So the first thing that we can do is add a vertical layout. So I'm going to say editor-gui-layout.begin-vertical. And now we allow ourselves to put these things into basically boxes if you will. Alright, and these are kind of containers that you put your UI into. Alright, and we'll take a look. It'll actually become more evident as we get through more of this. So anytime you begin a vertical you need to end a vertical. And so we're making a vertical layout for this. So to see this what I want to do is I want to add a GUI layout.space. It allows me to add a padding between the values or these UI elements. And so what I'm doing is I'm adding a 10 pixel padding in the vertical direction between the top and the bottom of all these guys. So let's go back into Unity up here and you'll see it just space a little bit below this selected item here. And there you go. So you can see it move down a little bit. So now what I want to do is I actually want to space out the horizontal as well. To do that we can actually put that vertical inside of a horizontal. So let's do editor GUI layout. .begin horizontal. Alright, so hopefully you can see a pattern here. So there's editor GUI layout .end horizontal. So you always got to end those. And in between that horizontal and that vertical layout we can add that space as well. Like so. Alright, so let's go and watch that in action. So now we have a little bit of space there. It just helps, you know, it's one of those subtle things. It just helps you see stuff a lot better. Alright, so let's go back into Unity up here. And what I want to do is I want to go in here and add some styling. That's what we're going to do. Thank you. So let's go in here and the first thing I want to do is I want to add an editor style. Editor styles. And I'm going to make this a mini text field. You can see we have a bunch of, let's do mini and text. There it is. Alright. Very cool. Okay, so I'm going to copy that and we're just going to plop that in for all these other guys and then we're going to go back to Unity and take a look at that. Okay, so let's go back to Unity. And this will change the look of it. Alright, so this is in the mini text fields. And you'll notice that what happens is they get mini. But I like the look of them. Alright, so what I want to do now is I can actually force it to override. So we can say GUI layout dot expand width. And we'll just set that to true. Alright, so let's copy that for all the others as well. So I'm going to jump down here and paste that as well into there. Alright, let's take a look. And there we go. So now we're expanding it. Pretty cool. So now what I want to do is I want to put a little box around it. So inside of our begin vertical here what I can do is I can actually utilize that editor styles again. Alright, and I can say editor styles and we can say help box like so. So we can put a style into that and it'll surround it with a nice cool looking little box. There we go. Not too shabby. Alright. So that's our prefix name and suffix. Okay, so the last thing I need to add is that Boolean. So we need a little toggle. Alright, so I'm going to put that into this vertical layout here. So what I'm going to do is I'm going to say add numbering is equal to an editor GUI layout dot toggle. So and we want to utilize the again the label and value override. So the label is going to be add numbering and I always like to put a little question mark after that in a space and then we'll put in the variable that we want to populate with the value of this toggle. Alright, so it's constantly assigning it to it. Alright, let's jump back in unity now and just take a look. We should have a little toggle right below here. Super cool. Okay, so now we can turn that on and off. Alright, so the last thing I really need for my UI is a button because the button is going to be what actually runs the functionality of renaming everything. Okay, so I'm going to jump back in unity here and outside of this begin vertical here, I want to create another vertical and actually let me put in the button first so you guys can see. So I'm going to say if GUI layout dot button. Alright, so this button is going to return a true or false value. You can see down here returns a bool. Okay, so if this is true, so this button is going to be named rename selected objects. Alright, so if that value is true then we're going to run some code in here. Okay, so we'll say debug dot log and we'll say renaming objects. Like so. Cool, so let's jump back in unity now and we should see a button down here but there's going to be a little bit of a trick to this. It actually ends up on the side here and you can see that we're running that log which is great, but I really wanted this button down here. Now you can obviously leave the button on the side as well if that suits your desired aesthetic. But what I'm going to do is I'm actually going to put it down on the bottom. Okay, so I'm going to do another editor or GUI layout dot begin vertical like so. And we'll do editor GUI layout. Oops, let's do that one more time there. So editor GUI layout dot end vertical. Always need to close it. And Unity will remind you if you forget one of those things. So I'm going to put the space in there again just keep things nice and clear. Alright, so now this button is going to move down to the bottom here and it didn't. And I got that wrong didn't I? So basically what we need to do is we need to put it inside of, oh that's what it was. So sorry about that. I just need to move the begin above all this right here. Like so. So you've got to keep all your vertical and horizontals nice and clean. And the reason why I'm doing this is because I want the button outside of the box. The help box here. Alright, there we go. Cool, so now we have the button at the bottom, but it's a little small. So let's go and do some styling to this as well. So you can add in all these options. So I'm going to do a GUI layout dot height and this height is going to be something like 45 and it's not a string. It's just a number. Okay, and I want to make sure that this expands as well. So I'm going to do GUI layout dot expand with is equal to true. Cool. So there we go. Let's go back to Unity and make sure that this actually looks correct. And there we go. So now we actually have a pretty cool looking tool and that's just using all the default Unity UI stuff. Alright, so very cool stuff. What I want to do now is I want to show you guys another little look and then I'm going to close out this particular lecture. So currently we have to come up to the menu and hit rename objects. That'll pop up the menu which is great. That's totally fine. But what I can do is I can come back to my object rename menu and I can actually add a little bit of information to our menu item here and that information is going to be a percentage sign which stands for control. Alright, and then a hashtag sign which stands for shift and then the keyboard key that I want to use for my hotkey. Now this combination of items, alright, or the string right here means I need to hold down control, shift and R on the keyboard. Alright, and that will actually run this code as well. Okay, so let's go save that and try that out here inside of Unity. Alright, so I'm going to hit control, shift and R and voila, look at that. So now you can start building up your own custom sets of menus and editors that are launched from specific hotkeys. Now you definitely need to make sure that you go into the edit here into the preferences and then into keys and you can see that some of these are already hooked up to hotkeys. So definitely make sure you can see which hotkeys are already occupied. And then just add on your own. Cool. So I'm going to leave you guys there and in the next lecture we are going to get this all hooked up so we're renaming objects. Thanks so much.