What data type should I use to instantiate materials/textures? (C++)

How do they do here to be able to load materials or textures?

Captura de pantalla 2024-06-29 145526

I was looking in the class hierarchy but I only see this parent i can use (UObject). I think it’s too generic…

Captura de pantalla 2024-06-29 145615

Captura de pantalla 2024-06-29 145639

Is there some type of data or interface that I can use and expose to bluprint to instantiate Materials or textures (UTexture2D* and UMaterialInterface*)

Thank you so much!!

This is how they do it in FSlateBrush

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Brush, meta=(AllowPrivateAccess="true", DisplayThumbnail="true", DisplayName="Image", AllowedClasses="/Script/Engine.Texture,/Script/Engine.MaterialInterface,/Script/Engine.SlateTextureAtlasInterface", DisallowedClasses = "/Script/MediaAssets.MediaTexture"))
TObjectPtr<UObject> ResourceObject;
1 Like

How did you know?
Thank you very much @zeaf

I just checked the source code for UImage because I knew it was used there among other things, and found the Brush property which led me to FSlateBrush

1 Like

Thank you!! :heart:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.