 All righty, so let's finish up this grouping tool by actually performing the grouping action. We've got our UI all up and running, and we've got hotkey launching this particular editor here. So, Control Shift and G. We can enter a name, and we can fire off some code with this button right here. All right. So, before I actually get going, one thing I did want to show you guys that I haven't shown yet, is how to give your scripts a custom icon. So, what I want to do is create a new folder here, and I'm just going to call this icon. And you have to do this. If you want this particular icon to be assigned to these scripts, it's got to be within that editor folder, so just it goes with the tool when you go and make this into a package. All right. So, what I want to do is just import the IndiePixel icon here. So, let's go and let's go back to IndiePixel, actually desktop here, and I'll roll through all my stuff here. So, branding, logo. So, let's get the 32 pixel icon. So, now that I've got this inside of my project here, what I can do is I can literally just go click on the script and hit this little drop-down right here on the script icon, and hit the Other button and select the icon. And then I'm going to click off of that. It'll compile for a second or two, and then you'll notice that the C-sharp icon switches over to your custom icon. Really cool way to identify what type of script this is. So, you could do it by who created the script, so if that person has their own logo or something like that. You can also create custom icons based off of what type of script this is. Since these are editor tools, maybe you want an editor tool icon. It just helps you be able to identify what your script is a lot faster. Also makes it just really neat and clean and professional. So, all right, so with that, let's go and get the tool here actually grouping some stuff and firing up or assigning the game object that particular name. So, one thing I want to do is keep track of what or how many current selected objects we have. So, this is going to be an int. We'll call this current selection count. It's a long name for a tiny number. It could actually be a large number. So, one thing I want to do is up here. So, this current selection count is going to be inside of this code at the very top here. It's going to be equal to selection, not the election, selection.active and it's .gameObjects. There we go. So, this returns for us an array of the game objects, which is actually a good thing to do. So, let me actually finish this for you. So, you'll notice it returns an array of game objects. So, what we could do is we could say .length, all right, now we'll populate this. But I do want to be able to access that, the game object. So, what we're going to do is create a private array of game objects like so. We'll call this selected, okay. And what we can do then is assign everything from our selection.gameObjects method here, okay. And we don't want the length anymore. And then we'll just take the current selection count is equal to selected.length. All right, so let's go back and test this out now. It's under the editor. And we also need to be able to display that information as well. So, I lied. Let's go back up here. So, what we're going to do is we're going to say editor, editor, GUI layout.label field, all right. We're going to say selection count like so. And we'll add on the current selection count.toString like so. All right. And then I'm going to want a little bit of space between all this. So, let me show you another way to do spaces. So, we can do a GUI layout.space. The cool thing about this one is that we can actually provide it a pixel value. Whereas the editor GUI layout space, if I were to look at the arguments, has no arguments, no overrides either. So, I use this one to give something like five pixel space between all this stuff here. So, let's put one also between the button. Cool. And we'll make this one a little bit less. We'll say like two. Cool. All righty. So, now you can see that our selection count isn't changing. But we are selecting objects. And that is just because you'll notice now it updated. We're not repainting our tool. And so, what we need to do is constantly update this on GUI. So, at the very bottom here, what we do is just do a repaint like so. So, now this will actually be real time. All right. So, let me click off. You can see that now we're getting the real time selection. Cool. So, let me go and make two boxes here. Let's make a... Well, let's do two spheres then actually. All right. So, let me put in two spheres here. We'll just make one a little bit bigger. Okay. So, what I want to do is be able to select both these objects here. And I just want to give it a name. So, I want to give it like a sphere. And I'm going to automatically add the underscore group to the end of this. And when I hit this button, it'll actually parent to these spheres underneath an empty game object. Okay. So, let's go in and do that. So, to do that, I'm going to create another custom method over here. We're just going to do a void. And we'll say group selected objects. All right. Cool. And so, the first step into getting this to run is to call it from our button over here. Okay. So, we're going to say group selected objects. And the first thing we want to do in our method over here is check to see if selected.length is greater than zero. All right. Cool. We should probably initialize selected there. So, let's just do a new game object array with nothing in it like so. Cool. So, if we have more than, well, if we have anything selected really, we should go and create a new game object. So, this game object is going to be called group Geo. That's what I usually like to call it. And this is going to be equal to our new game object. And you'll notice that what we can do is we can provide a name to it right off the bat and a bunch of components that you might want to attach to it. We're just going to use this string name for right now. And our name is going to be whatever the user typed into this particular text field. So, this wanted name. All right. But we don't want to just leave it with enter name. So, what we need to do is we need to first do a check right after all this here. So, what I'm going to do is I'm going to say if the wanted name does not equal enter name like so. All right. So, if it doesn't equal that, that means it's something different, which means somebody typed something into it. Otherwise, if it does equal that, then we should do a little bit of an error dialog for the user just to tell them that they need to actually put something in there. So, we can do the editor utility dot display dialog like so. And this takes the title. So, we'll just say group grouper message or something like that. You can put in whatever you want. And we'll say, what's the message? So, the message is going to be you must provide a name for your group. And then for the button, we'll just say okay. Like so. Perfect. All right. So, let's just go make sure that that works. So, I'm going to close this down and relaunch it with my hotkey and hit group selected. And you'll notice that because I didn't change the name, it says you must provide a name for your group. Perfect. So, if I were to type in sphere and say group selected, we get a new game object up here. All right. And that's just because we haven't named it yet. So, we'll give it a name. So, over here, we're going to give it our wanted name plus underscore grp. All right, because I just don't like to have to type that in all the time. And sometimes I mistype it, then I have to go and fix it. And that's like 20 seconds of my time taken up when I have lots to do. So, that's how we write tools and we automate things for ourselves. Cool. So, now we have the name assigned to our group. All right. And then what we want to do is we want to take all of the selected objects and we want to parent them underneath our group. So, what we'll do is we'll just come over here and we'll do a for each. So, let's say for each transform, actually, it's going to be game object. So, for each game object, right? Because this stores a whole bunch of game objects. We'll call this Kerr-GO in selected, like so. All right. So, we're going to loop through each of the game objects that's stored in the selected array. And we're going to say that the Kerr-GO, whichever current child we're working on, or current object in the array here, dot transform, dot set parent. All right. So, the parent is going to be our group, GO dot transform. Okay. So, let's talk about that here really quick. So, this set parent method is attached to or part of the transform class. All right. And it takes a transform. So, we have to access the transform of the current group that we just created up here. And so, that basically assigns that to the group. So, let's go and test it out. So, for each game object that we currently have selected, it'll get parented to our new group, GO. Just like that. Okay. So, let's just select these two guys. And we'll hit group selected. And voila. There we go. We now have these objects grouped. Perfect. And that, my friends, is how we do that. All right. So, a good upgrade to this would be to add in a ungroup selected. All right. So, you can go in here and basically ungroup all these guys. But I'll let you guys, you know, work on that. Let me know if you guys have any questions. Thanks so much.