0
\$\begingroup\$

Watching a Unreal Course, and the instructor is creating a default pawn c++ class. He is adding all the components with code, but this seems really inefficient to me. Why can't you add components in the engine like you can with blueprint classes? Also, I know you can convert c++ classes to Blueprint classes and still code using attached c++ components, is there a downside to doing this?

my main questions are these:

What is better about adding components in code?

What is the difference between creating a blueprint class and creating a c++ class but converting it into a blueprint?

What are the benefits of each? thnx.

\$\endgroup\$
2
  • \$\begingroup\$ Linking to your course could help users here see better the issue and what you mean and why the tutor suggests XYZ. \$\endgroup\$
    – Vaillancourt
    Commented Jan 20, 2021 at 3:16
  • \$\begingroup\$ it's the gamedev.tv Unreal C++ course, but it costs money so I'm not sure it would be helpful. I"m currently on the Toon Tanks section. \$\endgroup\$
    – Millard
    Commented Jan 20, 2021 at 3:22

1 Answer 1

2
\$\begingroup\$

For a bigger project, the C++ programmer is unlikely to be the level designer or artist responsible for the items in BP.

Adding items in code means that the non-programmers cannot remove components that are critical to the running of that code because they don't know why they're there.

You don't make a C++ class and convert it to BP. You create a Blueprint based on a C++ class which contains all the functions and variables which can be exposed to BP with UFUNCTION and UPROPERTY respectively.

C++ is faster than Blueprint since BP uses an emulator to call C++ code in the engine and is slower (tests have shown by up to 7x slower) and with C++, you can get hold of the parent C++ code and modify it as you need to.

C++ can be much simpler as well. In the original, now archived course, the next section is Testing Grounds and introduces behaviour trees and blackboards. In one of the modules, the Blueprint part is made up of 12+ nodes which, when converted to C++ is 3 lines long.

Blueprints, on the other hand are considerably easier to prototype with and will quickly tell a programmer whether something you're planning is achievable.

There are also scenarios where C++ is more work than you'll get benefits from; displaying UI is the biggest one of these.

\$\endgroup\$
1
  • \$\begingroup\$ thank you for your detailed answer. I am not against c++ (I like it much better than blueprints) I was just unsure about adding components with code, thanks for clearing it up. =) the part about blueprint nodes was helpful too. thnx. \$\endgroup\$
    – Millard
    Commented Jan 20, 2021 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .