Download

the "getting started" video series.

Hi guys,

I was just wondering if you’ve considered putting out another getting started series that avoids the use of blueprints entirely? i realise that blueprints are a powerful tool, and they’re great for quick iteration and for artists to be able to perform certain tasks without bugging programmers.

But there are already tutorial series dedicated to blueprints… I watched this series in the hope that i would learn some of the UE4 specific programming “quirks”, like how you call/set materials and things like that via code. But all of that stuff is handled via blueprints in this video set:

In fact, over a quarter of the total tutorial time is spent in blueprints. So if possible, could we get an alternate recording going over this stuff in code only?

Thanks!

Hi Almighty_gir (awesome name, by the way)!

When I designed the Introduction to UE4 Programming series, there were a few things I wanted to show. Most of them were programmer-focused, like how to use the UCLASS, UFUNCTION, and UPROPERTY macros, how to define and override functions, and accessing variables and functions from other classes. Hopefully, this cleared up some UE4 programming quirks in those areas. :slight_smile:

You’re right that there are parts in Blueprints - and these are places where it really is ideal to combine C++ and Blueprints. These are things like the timelines and asset references that we used to drive the power-up material. It’s possible to do these in code, but in tutorials (especially introductions), we really want to show you these “best practices”, and how we set up projects here at Epic.

I can definitely see the value in code snippets that show you how to set a material in C++ alone, but since this would require you to change your code if you ever wanted to rename or move the asset, it wasn’t the method I chose here. As we add on to the documentation, there will be places where we do provide code examples showing you how to do things like that, because we understand that people will have different preferred workflows. :slight_smile:

Thank you so much for your feedback, and I hope that helps to answer some of your questions about this series.

Do you mean how to get/set materials on a static mesh / skeletal mesh?

Or do you mean how to reference a material you made in Editor in code?

Because for referencing materials you definitely do want to use blueprints!

Reason:

When you package your game, asset paths change, and if you hard coded your asset path in C++ it may not make the transition to packaged game!

Using the editor / blueprints to reference materials into code is the ideal way to do things, because you can then also easily change the materials at any time using the editor!

The packaging system handles the proper linking of all your assets that are referenced using BP defaults :slight_smile:

Sometimes I only open the editor just to set these various asset references for use in code, and then close it again immediately and go back to coding, so that is one workflow to get used to avoid headaches later when you are packaging your game.

Just to be clear, I mean asset references like this:

.h


**//BP Classes**
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="My BPs")
UClass* SelectionMeshBP;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="My BPs")
UClass* VictoryWallBP;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="My BPs")
UClass* VictoryDestructionBP;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="My BPs")
UClass* EditorXBP;

**//Particle System**
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=ExplosionPS)
UParticleSystem * TorusMeshRadialExplosionPS;

**//Materials**
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Materials)
UMaterialInterface* MyMaterial;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Materials)
UMaterialInterface* MyMaterial2;

It’s not less efficient to do this involving the editor, making a BP of the above class which has all these references to other project assets.

It is the most time efficient and project efficient thing you can do :slight_smile:


**Global Data Storage Wiki**

There is a C++ class that UE4 provides if you want to store all your game assets in one place, to use anywhere in your code base:

https://wiki.unrealengine.com/Global_Data_Access,_Data_Storage_Class_Accessible_From_Any_CPP_or_BP_Class_During_Runtime!

Rama

Thanks for the responses guys!

Lauren, thanks for taking the time to do the tutorial in the first place. It’s been very handy for learning the quirks you mentioned! Also, all hail the mighty tallest!

Rama, that makes sense! thanks man.