Post-Process blendables array

Hello,

I’m trying to assign a post process by default to a UPostProccessComponent but I can’t understand why I can’t add something to the blendables array.

Here is my code :

PostProcessComponent = PCIP.CreateDefaultSubobject<UPostProcessComponent>(this, TEXT("PostProcess"));
	FPostProcessVolumeProperties prop = PostProcessComponent->GetProperties();

	ConstructorHelpers::FObjectFinder<FMaterial> DefaultMaterial(TEXT("/Game/Materials/MonsterPostProcess"));
	if (DefaultMaterial.Succeeded)
		prop.Settings->Blendables.Add((UObject*)(DefaultMaterial.Object));

It says that my argument type is UObject* and it must be const TArray

I tried several things, like creating a TArray, adding my object and giving this array as a parameter for Blendables.Add, but it didn’t work either.

I know that the ‘const’ part is important but it’s been a while that I didn’t get to use C++ and I’m a bit lost :confused:

Same here, I’m trying to add/remove (or enable/disable) some of the blendables at runtime. I just can’t find a way to do so…

Here is the solution for your problem: Don’t cast the found asset to FMaterial. FMaterials are not UObjects.

ConstructorHelpers::FObjectFinder<UObject> DefaultMaterial(TEXT("/Game/YourAsset"));
	if (DefaultMaterial.Succeeded())
	{
		PostProcess_Selection->Settings.Blendables.Add(DefaultMaterial.Object);
	}