Closed jvukovich closed 5 months ago
You can't create UMaterialInstanceDynamic
in lua directly, because Create
is not a ufunction in Unreal Engine source code.
static UMaterialInstanceDynamic* Create(class UMaterialInterface* ParentMaterial, class UObject* InOuter);
But you can write a wrapper ufunction for Create
in your own UClass:
In c++
// in your UClass
UFUNCTION()
static UMaterialInstanceDynamic* Create(UMaterialInterface* ParentMaterial, UObject* InOuter);
// skip implementation
In lua:
local Ret = UE.YourUClassName.Create(MaterialAsset)
Ok, cool, thank you! I did ultimately create a wrapper to get around it; thank you for confirming and the explanation!
How can I use UMaterialInstanceDynamic in UnLua?
I tried a bunch of variations, but nothing worked (always got nil errors trying to call Create()):
UE.UMaterialInstanceDynamic:Create(MaterialAsset)
UE.UMaterialInstanceDynamic.Create(MaterialAsset)
UMaterialInstanceDynamic.Create(MaterialAsset)
And a bunch of other variations, but no luck.
I tried looking at the UnLua code, but wasn't able to figure it out.
Thanks!