 On this tutorial we're gonna create a name generator that you can use either from code or from the visual editor. There is a game jam starting next week organized by the community and the goal is to create Godot add-ons so it might be a great opportunity to start creating one. If you have no ideas about what kind of add-on you can create there's a list of ideas here at the end of the description so you can read it and I'm sure you're gonna find something that is interesting to you or at least inspire you to create something original. So there are many different ways of add-ons. There's the add-ons that you have here on the inspectors, the ones that you have inside of the screen, the ones that you only see from the backend. So the one I'm gonna show you how to create today is just a few steps of making one similar to what the logic is which is a main screen plugin and you will be able to generate random names for your characters. So the first thing we're gonna need is to go to project, project settings, plugins and there's a button here which is called create. Now Godot is gonna ask for some properties that we need to fill. In this case let's say name generator, the name of our plugin, the name of our folder, author, me, version 1.0, language to the script, the script name is going to be plugin.b. We activate it now and we have our first plugin. That's it. Thank you for watching. No, no, let's continue. So now that we have our plugin, on the enter tree you're gonna initialize everything that you might need from your plugin and the exit tree you're gonna clean everything that you initialized. So let's create now one scene which is gonna be our main panel. Gonna be a control node container, box container, vertical box container. We have our container here and we're gonna add two things. A button is gonna be generate name and we're gonna also add another container but it's gonna be a horizontal one. Let's do another button for copying the name that we generated and line edit. So here we're gonna draw the name we have. Let's go ahead and make this layout full rect and input the size flag, expand horizontal. So we have it like that. So this is what we're gonna have on this new tab that we're gonna create. It's a very ugly UI but it's gonna get the work done. When we press here on generate name and then we'll show up here and then when we press on copy we're gonna copy to the clipboard to use anywhere we want. Let's save this and preload it in so const main panel, preload, we drag and drop this thing that we want, just the main panel that we created. Let's make this bigger, okay. Now that we have it let's create here an instance. So to save it let's say main instance and main panel instance is gonna be a main panel instance. So what we're doing here is we're creating an instance that we can reference and the enter tree script is for initializing. That way we add it to the plugin and to the editor and we need to clear it once the plugin is not being used. So if main panel instance exists, main panel instance q3. So now that we have this we're gonna add the instance that we created. First we get the interface, the editor viewport which is where we are working right now like in Godot and we add a child which is this new thing that we created. We hide it. Now we tell Godot that we really want to have this as a main screen plugin instead of just like a regular plugin that runs in the background and we need to find the make visible function. In this case the same as we did with the exit. If it is there we can access it so it's gonna be visible. For the name of the tab that we're gonna have here, we're gonna need this function called get plugin name. This you need to return a string with the name of the plugin and after this our last one is having an icon. In this case I'm only getting like the regular node icon but you can pick anyone from the Godot editor or you can make your own image and use it there. Now that we have everything we are going to go ahead and save and the first thing you're gonna notice when making plugins is that you're gonna need to reload the editor a lot. In this case since we're not doing a lot of stuff we can go ahead and instead of reloading the entire editor which there is like a reload current project we're gonna reload the plugin so we go to plugin settings in plugins here when you have enabled you disable it and you enable it again and you see your plugin appears. It has the name from this string and the icon that we set here. We see the scene that we created so this is the scene that we did and nothing is happening here we haven't added any code to it but as you can see the panels that we created are here. Even though you see the UI elements with the default Godot ugly game theme you're gonna have them with the native theme once it's in the editor. If you want to start it properly you're gonna have to create themes and also probably adding some padding on the sides because here is all the way to the borders we're gonna ignore that and continue with the tutorial. Now that we have our visual part of it let's create the code that will generate those names so inside the add-on folder that I created let's make a new script that script is gonna be the name generator. The naming is not great but okay let's remove everything and let's use the class name name generator this will make it so that in every instance that you have in every script that you have you're gonna be able to call name generator and any of the functions that you have here. If you want to learn more about class names I'm gonna leave some links in the description but as with everything else in this tutorial I'm assuming you already have some basic Godot knowledge otherwise we're gonna spend so much time covering every little thing. Let's create a new static function which is new name. This new name function is gonna have three arrays with the beginning of the name, the middle of the name and the end of the name so we want to pick randomly from the list and show them to you all together for that we're gonna need a small function as well to pick a random element from an array. This case is gonna be pick random it's gonna take an array and we're gonna randomize it you need this because otherwise the output is gonna be always the same when you test it. Let's return the random of start a random of the middle and random from the end. Let's go to our editor create a new script for the main panel and let's connect the button connect press self and let's create the on button pressed function so that we generate one of those names. We create a variable to store the name we use the name generator new name which is the function that we created and now we set the line edit that we have here with the new name and we print it on the terminal to know that it was working. When I saved this you can notice that nothing happens if I click it even though the code was there because as always we need to reload the editor and another thing you have to have into account is that Godot needs to know that this script has to be executed on the editor and not on the game to do that you need to add at the beginning the keyword tool so that way God knows that okay this is something I need to execute in the editor so the button connection and the button press are gonna be working remember if you don't see your script working check that you have the tool keyword at the beginning now let's reload the plugin we enable disable it and we press here we start seeing that we are generating names they are not the best names but you know they are random names so you can use now we connect the copy button we make the copy function which will take the os clipboard and add the text that we added previously which is the name that we generated to the clipboard save and let's reload the project just in case okay we reloaded the plugin and when I generate the name so it's press copy and I paste and it works as you can see there are many things that you need to take into account from the front end of the addon to what functions you're gonna be using and also handling what kind of plugin is gonna be but you can build on this as you would be building any game saving data loading data or modifying existing files cool thing about doing it this way and now having that class name name generator is that if you have another instance in your game and you don't want to use the name generator like this but you want to use the function that we created let's say this as main and imagine that this is a character that you have that it has here like you want to add a cool name to it instead of going into the plugin here creating one copying and adding it here because you don't mind you can create a script and in that script we can set on the label text we can access the name generator you see the class name we did and we do new name which is the function that we created and when we run the game right now it doesn't have anything but when we run the game and name was generated so not only your plugin will help them use the functionality from code but also if they want to use it manually here you can also do so that's how I started building dialogic then it grew into many other stuff there's a lot of people working on it there's a lot of stuff that I don't understand from the god editor but the plugin is basically just what I showed you taking to a different level looking forward to see your games on the add-on jam I will try to participate if the time allows and good luck with everything check the links bye