get the texture if I have it's name in a string variable?


How can I get a specific texture that is in a location (Content\UMG humbnails), when I only have the name (string value) of that texture.
My texture is named testTexture (that is also the string value that I have in my string variable).

Thank you

Cast to texture, and then get the object display name from the output of texture cast. Do note that you need an input texture object to the texture cast.

I’m not sure I follow, if I already have that texture object, I don’t need the string to find it in the first place.

Could you perhaps make a screenshot of such a blueprint.

thank you.

Texture Cast.png

So I created a texture array that is encompassed within that blueprint, and then I loop through the elements to check whether the object display name from each element matches the requested one. The texture object that is referenced does not refer to the texture that is found in your thumbnails file location.

Thank you for the clarification. The thing is that you’ve add the textures upfront, manually in the array, before pressing play. What I’m wanting is to be able to dynamically (in runtime) find and get the texture (that is in the content browser) just by the string variable. Is there anyway that I can avoid putting the textures manually in the, array?

Thank you again for your time.

I couldn’t find any functions pertaining to the texture class that would allow you to set a texture based on a string variable. However, it is definitely possible to implement this in C++, you can convert your BP object into a C++ class and extend it with certain functions of yours.

Official documentation from Epic:

Alternatively, since Rama has a plugin that allows you to call textures from a file path, you dont really have to reinvent the wheel :slight_smile:

This is great! Thank you!