Generating Source Code
I assume you already have an Unreal project created. Before we can write code, we need to generate the solution (.sln) file so we can open our project in our IDE.
Did you create a C++ project?
Then you're already done with this part! Feel free to skip ahead to the next page.
Adding source code to a Blueprint project is simple.
- Open your project
- In the Tools menu, select
New C++ Class...
- Click the
Create Class
button - Click through any additional pop-up prompts
- Your source code editor should open automatically and you'll be ready to code!
The class we just created should be located in our project's /Source
folder. We won't be using this class, so feel free to ignore it (or delete it if you like to keep things clean).
Not using Visual Studio?
At this point it would be a good idea to open Editor Preferences and set Source Code Editor
to whichever one you are using. This makes it so when the editor opens source code files it will launch your preferred editor.