I have a Media Player that plays a video on a plane with mp_fp_tex_1_Mat as its material. when a button is pressed, I want to copy that Media Player to another plane that is in a “full screen” view . Any suggestions on how to do this?
I currently have in the constructor:
for (int i = 1; i < size+1; i++) {
FString str_path = FString("Material'/Game/media_players/");
FString str_path2=FString("");
str_path2.Append(prefix);
str_path2.Append("_");
str_path2.AppendInt(i);
str_path2.Append("_Mat'");
str_path = str_path + str_path2;
static ConstructorHelpers::FObjectFinder<UMaterial> Material(*str_path);
if (Material.Object != NULL)
{
UMaterial* mat = (UMaterial*)Material.Object;
MyMaterials->Add(str_path2,mat);
}
}
and in my set material , I tried setting UMaterial to dynamic to no avail :
SetViewerMaterialToMediaPlayer(UMaterial* material) {
// set material.
if (viewer1 == NULL)
{
return;
}
DynamicMaterialInst = UMaterialInstanceDynamic::Create(material, this);
//set paramater with Set***ParamaterValue
//DynMaterial->SetScalarParameterValue("MyParameter", myFloatValue)
int matNum = viewer1->GetStaticMeshComponent()->GetNumMaterials();
for (int i = 0; i < matNum; i++)
{
viewer1->GetStaticMeshComponent()->SetMaterial(i, material);
}
I also have another method that successfully picks the material based on the name/id of the Plane .
Set material is just setting a checkerboard material to the plane. It is not setting the media player to the plane . I’m not sure why.