Without wasting your time, I am explaining quickly the problem.
1: I have the texture in the data table.
2: I want to grab that texture and set it to the Param2D in the material with the parameter texture name is MaskShirt2D
3: Next I will post the code currently I am trying to achieve this.
Hi Alexa, are you setting the dynamic material in the default constructor or OnConstruction?
Please provide this information I will try to solve, Thanks
your dynamic material will always be nulled while it calls only once on runtime, you have to call InitSkeletalMesh(); under OnConstruciton or call it after you check for case.
void APUBGCharacter::OnConstruction(const FTransform& Transform)
{ //Call Super and then InitSkeletalMesh();}
or
case EFashionType::E_Jacket:
{
InitSkeletalMesh(); //Calling this here will always return **Material_BodyRef** `!null`
if (::IsValid(Material_BodyRef))
{//Logic}
}
Calling that function only when it need to be called will save performance, don’t call in tick , you don’t need that to be called every second, only if in EFashionType::E_Jacket: you wil need to call it and in other conditions as I can see in you Enum , you have other cases too.
cheers.