But in UMaterialInstance* matInstance = UMaterialInstanceDynamic::Create(StarMaterial, this); I get this error:
NewObject with empty name can’t be
used to create default subobjects
(inside of UObject derived class
constructor) as it produces
inconsistent object names. Use
ObjectInitializer.CreateDefaultSuobject<>
instead.
I get this error because I’m using Create inside a constructor. Is there any other way to create a MaterialInstance inside a constructor? or maybe, where can I create this MaterialInstance.