Hey, I’m trying to get a hold of a MaterialParameterCollection in C++. Here is the code I am using:

static ConstructorHelpers::FObjectFinder<UMaterialParameterCollection> MaterialCol(TEXT("MaterialParameterCollection'/Game/Characters/Materials/RoxyBody'"));
	if (MaterialCol.Succeeded())
		BodyMaterialCollection = reinterpret_cast<UMaterialParameterCollection*>(MaterialCol.Object);

However I get the following error on compilation

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2664	'void ConstructorHelpers::ValidateObject(UObject *,const FString &,const TCHAR *)': cannot convert argument 1 from 'UMaterialParameterCollection *' to 'UObject *'	DarklightProject	C:\Program Files (x86)\Epic Games\4.12\Engine\Source\Runtime\CoreUObject\Public\UObject\ConstructorHelpers.h	105	

UMaterialParameterCollection inherits from UObject, so I have no idea why it is not able to convert it.

You shouldn’t need to cast the object at all, just use BodyMaterialCollection = MaterialCol.Object.

Bear in mind, you can’t change any properties of that collection asset. Each world creates an instance of a material parameter collection, and you should instead modify that instance. See UKismetMaterialLibrary for more details.