How can I apply a Material to an imported Static Mesh?

I think this is what youre looking for? Go into your content browser, and click import, from there browse to the fbx file you want to import that contains your mesh. Import it then click and drag the mesh into your scene, and then click and drag the material from the content browser onto the mesh.

If the material isnt in the content browser, just simply import it like you did with the mesh. Is this what you mean? Get back to me and ill see what else i can help with

I am trying to programatically apply a material to every static mesh that I am importing in my static mesh importer.

Lets say the material I would like to apply is located at /Game/MyMaterials/my_material.my_material.
Lets say that I also have a static mesh in hand that I have just imported (UStaticMesh staticMesh;).

How would I import and apply a material to this mesh? I assume that I am going to be adding/modifying the Materials array in some manner.

I am looking to do all of this programatically. I already have a static mesh importer and I need to apply a material to it in the C++ code.

The method you are describing is manual, and not code.

Ohhhhhh okay, im not much of a programmer, more of an artist with basic programming knowledge, sorry about that man. Hopefully someone with a little more understanding of C++ can help you out.

No problem thanks for trying.

hey there,

try .cpp:

ASolidBlock::ASolidBlock(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
	Block = PCIP.CreateAbstractDefaultSubobject<UStaticMeshComponent>(this, TEXT("SolidBlock"));
	static ConstructorHelpers::FObjectFinder <UStaticMesh>StaticMesh(TEXT("StaticMesh'/Game/Blocks/SolidBlock.uasset'"));
	static ConstructorHelpers::FObjectFinder<UMaterial> Material(TEXT("MaterialInstanceConstant'/Game/Materials/M_Basic_Floor.uasset'"));

and .h :

    class ASolidBlock : public AActor
    	virtual void BeginPlay() OVERRIDE;
    	// static mesh
    	TSubobjectPtr<UStaticMeshComponent> Block;

This right here is the code I was looking for. You might want to go answer my question Here