How to convert a UE4 Blueprints project to C++ Part 1

Blueprints are the Visual Scripting Language in UE4 and a large portion of the C++ API is available in them. Starting out a new project its always nice to get the basic mechanics on the screen as fast as possible and Blueprints are great for this.

But…

There are considerations besides performance of why you would want to use C++ in Unreal Engine 4.

If the purpose of Blueprints is to make things easier, but something would be easier to do in text, then that is where it should be done. They both have there place.

The real reason I like using Blueprints is because of how I can add and configure game objects in the Editor to it, and then directly use those objects on it’s Event Graph. In C++ there is more overhead in setting up components, and you can’t adjust things like offsets visually.

But, when it comes to sorting, searching and acting on collections Blueprints are a real pain. If I have a collection of  BaseClass variable in Blueprints, and want to do something different on each subclass in it, there is going to be a large spaghetti of repetitive Blueprints Nodes, getting the Class, comparing it etc.

SpawnActorsFromClassBP

So, the natural thing is to add C++ to the previously Blueprint only project. Actually adding it is very easy, just right click in the Content Browser and select add C++ class, choose a Base and name it. It’s that easy if you have set up Visual Studio.

But, where do you get started if you’ve only been programming with Blueprints in UE4?

I am going to list out some examples that should help speed you up, they are the things I had to hunt down, so I put them in one place here. This is as of 4.7, run from the launcher, adding C++ to a previously Blueprint Only project.

  • Spawn a Blueprint from C++
  • Get the components set in a Blueprint in C++,
  • Workflow for making new UE4 classes
  • Spawn Actor with AI in C++

 

Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *