How do I use SetStaticMesh and SetMaterial?

btw, this doesn’t work anymore due to changes in the engine. Every example I found on the internet was wrong. You start thinking you are going crazy…

Here are the fixes:

Replace this:
TSubobjectPtr Block;

With this:
UStaticMeshComponent* Block;

Add this constructor in the header:
ASolidBlock(const class FObjectInitializer& PCIP);

Replace this:
ASolidBlock::ASolidBlock(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)

with this:
ASolidBlock::ASolidBlock(const class FObjectInitializer& PCIP) : Super(PCIP) {

That should do the trick.

1 Like