Material Parameter Collection (C++)

Hello there,

I am trying to to use Material Parameter Collection in my C++ code. I try to create create the object with these pieces of snip-its below, but I link textalso get an error while compiling. Can someone please help me with this?

The error I received is attached to this.
link text
.h file
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Materials, meta = (AllowPrivateAccess = “true”))
UMaterialParameterCollectionInstance* playerMaterialParamCollection;

    .cpp file
    playerMaterialParamCollection = CreateConstructorObjectType<UMaterialParameterCollectionInstance>(TEXT("/Game/ThirdPersonCPP/Material/MaterialTransSwitch"));
    
    the function "CreateConstructorObjectType"
    template<class T>
    FORCEINLINE T* CreateConstructorObjectType(const TCHAR* path)
    {
    	ConstructorHelpers::FObjectFinder<T> objectType(path);
    
    	if (!objectType.Succeeded())
    		return nullptr;
    
    	return static_cast<T*>(objectType.Object);
    }

Don’t use static_cast with T*, use Cast with T.