 All right, welcome back. Okay, so what we're going to do in this video is get the window actually launching Okay, and we'll probably start, you know detecting how many objects we have selected and what we have selected and storing that in the variable So let's go and get back to the editor script over here. All right, so in order to draw a window Let's just do this down here. I'm going to declare just a generic variable We're going to call this our win and this is going to be equal to get window and a type of window All right, and what we need to do is put in the type of this particular window here and It's not type of we have to just put in the type. So we want object grouper editor All right Like so and that basically gets a window for us that creates it in memory but it doesn't actually show it just yet and What's cool about this is we can actually put in a title So if I were to just put in one of those parentheses, you can see we have a bunch of overrides here All right, so if I push down on the arrow keys, we have these options to turn it into a utility give it a title give it a bunch of Parameters here that where we could all try to dock it and stuff like that multiple, you know arguments here Stuff like that. All right. The one I'm going to use is to keep it simple right now is just add a title So I'm going to say group selected or something like that. I'll just go with that. Cool All right, so at that point this particular window is now created so we instantiated the window created an instance of it We're starting in in this variable. So what we want to do now is say win dot show and this actually shows the window cool, so let's go back to Unity and Try this out All right, so let's go up here and say Object grouper and voila we get a window super quick just like that And we have our title so with that let's go hook up our hot key or key combination there So inside of the menu here what I can do is I can add a combination of stuff So if we actually go take a look at the docs for the menu item here All right You can see that we can add a percentage sign for control or a pound sign for shift or The and symbol for alt and then just follow it up with a Letter on the keyboard. All right, so that's exactly what we're gonna do. So I'm gonna come back in here So I'm gonna do control shift g. All right, so control remember is that percentage sign? Shift is the pound sign and then I want g Like so and I deleted all that stuff there. Cool. So I'm gonna save that come back in unity And we'll try it out And I try to do this for as many tools as possible And there we go control shift g this will allow me to go and group things really fast So I don't have to right-click so create empty name it Then select all the things I want to put in the group and then drag and drop it in there We're just gonna do it in one button click. Okay. All right. So we got our hot key all hooked up Let's go back to the tool now the next Element that we need our ingredient for this particular recipe is our UI. So I'm gonna do the void on GUI method, okay, and In here, let's just get it going. We're gonna say editor GUI layout dot label field Like so and we'll just give it a string So let's take a look at those arguments there So we can give it a content label or just a string or we can do a bunch of stuff All right, we'll just do the string for now. So I'm gonna call this My label. I just want to check to make sure everything's working appropriately All right, so let's go back to unity And there you go. So now we have a label cool. So I'm just gonna close this down here like so All right, so what are we going to need? So we we want to be able to name the op or the group the new group that we create. All right So we're gonna have to store that so I'm gonna make a new private string. So this private string is gonna be called Wanted name All right, we'll just declare this to something like Enter name and we'll do a little debug checking. All right, and let's just make sure this is correct There we go. All right. So instead of this being my label, I'm gonna say group name And this is gonna sit on top of you know that the field where we enter the particular Group name. All right. So what I want to do now is I want to say that this wanted name is equal to whatever Input the user provides and to do that. We need to do an editor GUI layout dot text field All right, and this text field has a bunch of Overrides as well. All right, so we can do string text or we can give it a label as well In this case, I'm just gonna do the text. All right, so we're gonna call this wanted Name and this will basically whatever I type into this text field is gonna be put into this variable right here And we can use that information when we go and actually create The group. We'll just assign the game object that name Okay, so let's take a look at that All right, so I'm gonna use my hotkey And there we go. So now we've got Group name as label and we have enter name inside of this text field and I can go in here and call this boxes group Now all right, but you know because I like to keep that group Extension on just about all my groups. What I'm gonna do is I'm gonna automatically add that suffix to whatever name I give it All right, so one other thing I want to do is I want to kind of space this stuff out a little bit It's a little bit too tight to the top right because it's just filling up the entire Window area. All right. So in order to do that, we need to make use of layouts Okay, and so what I'm gonna do is I am going to declare a Editor GUI layout dot begin Vertical And we'll do this like that. So whenever you create a vertical We also need to close that vertical. So we're gonna say editor GUI layout dot end Vertical like so, okay great So now what we can do is we can stack all these objects together All right, or we can add space. So I can come in here and say editor GUI layout dot space like so and We'll put one of those at the bottom as well. So you can see we'll get a space at the top and bottom All right, so we spaced it a little bit on the top and bottom because we created a vertical layout So these things are now being laid out vertically Alrighty, so let's go and Push it over a little bit now there's a couple ways we can do this one way is to do the editor GUI layout dot horizontal We'll begin horizontal like so All right, and anytime you open Layout like this you want to close it. So we'll say end All right, and then we could also add a space right here and you'll notice that we get a space on the horizontal But what happens is that we get? The two elements right next to each other all right because now they're being horizontally laid out We got the space but that means now we have to put this group of UI elements into a vertical layout as well All right, so it's good to see this because it basically helps us to Get all this stuff going and honestly what we could do is you could do the horizontal first and Then do the vertical last like so and there you go so now we're horizontally moving everything over on both sides of the window and then we're Creating a vertical layout So that will work for us So it's just save all that and go back to unity And I'm doing this because I want the label on top of the text feel like so right completely aesthetic But now we've got it kind of in the center there and you can always stack these things up, too I want it a little bit more down on the Vertical there cool The other thing I want to do is provide a style to this so I'm going to say editor styles If I can spell that correctly editor style Like so give this a bold label, so let's go take a look at that cool. So we got a bold label All right, so with that What we need to do is put in the button now. All right, so I'm going to come in here and Just below here what I want to do is put in a button. So I'm going to put this within a if statement So I'm going to say if that GUI layout dot button All right, I'll call we'll give it a title of group selected Okay, and what we can do is provide a bunch of options in here. So we can say GUI layout dot expand width is true Like so and we can also do a GUI layout dot height so we can set the height explicitly to Some like 45 and then we'll just close this off. So we'll do a Debug log here. We'll say grouping selected So let's get rid of this debug lock because we don't need that anywhere cool All right, so we are pretty much good to go with our UI is base just a basic setup You can go and extend this as much as you want add other features to it like maybe an ungroup selected. All right Cool. So now we have our button and we are firing off the particular code inside of that if statement All right, so I'm going to leave you guys there in this video and in the next we're going to get this actually grouping some objects Okay, thanks so much