C++ and the Unreal API

Of course, I’d fall in love with Unreal as a C# programmer. I mean, who doesn’t want to take the most difficult path to everything, am I right? Since I refuse to let my obsession of Unreal go away (primarily due to its volume effects and lighting/sky system), I’ve decided to dive into their API trying to understand the architecture while grasping the nuances of C++. Thankfully, the basics of C++ and C# aren’t that different. I can read the C++ language. That wasn’t the case when I went from Lisp to C#. That alone puts me light years ahead of where I was when I started with C#. For example, I didn’t expect to be able to understand the tutorial I followed to construct a C++ Unreal project with a pickup system and custom blueprint in a matter of a few hours. I noticed I essentially struggle with the details in C++ that I would struggle within C#. Great news because those challenges others often run into and generally get solved with a little research or asking questions in forums; this tells me that for me understanding the structure of a language is probably more important than understanding the specific details for every aspect of it.

The system I constructed involves a C++ project using the First Person Template. The person walks around picking up industrial-like barrels. I began the project using Unreal Engine 4.22. Since the tutorial I found was about four years old, the code had to be modified/corrected due to API changes over the years.

industrial barrels

The first step was to generate a new class in the editor.

editor

After that it was a matter of locating the correct classes to include and adding the text in the below images to the header (.h) and cpp files.

header

cppfile.JPG

In a few hours, I completed the task I set out to do and am confident that I can dive and start to push things considerably further. It took me a few years with C# and various APIs before I got to that same level of confidence. Since I can’t up and quit my career to find a mentor, I pursue this stuff on my own.  Because of that, I was hesitant to dive into something new.  Don’t get me wrong, I understand that C++ is considerably different than C#, but realizing the differences and having accomplished my first task using the Unreal Engine API quickly enough makes me more excited to dive in.

Leave a Reply