Download

How to select (set) Texture2D realtime from Blueprint

I have “Make Brush from Texture” node and I can select needed textures from the dropdown list in editor, but how I can set this texture field realtime from blueprint if its name is saved in the string variable (for example, “af”). Thanks.

Example:

UPDATE:

In theory, there should be an ARRAY with all loaded system textures that I can loop, compare the name of the texture one-by-one, and post the right texture to in-socket of “Make Brush from Texture”.

Ok, thanks to Rotem, I found the way to do this using soft object paths:

  • Create a Make Soft Object Path node
  • The Path String should be the full path of a valid texture. You can see what that should look like by right-clicking one of your textures in the asset browser, selecting ‘Copy Reference’, and pasting that into a text field.
  • Plug the result of the ‘Make Soft Object Path’ node into a 'Convert to Soft Object Reference` node.
  • Plug the result of that into a ‘Resolve Soft Reference’ node.
  • Plug the result of that into a Cast To Texture2D node.
  • Plug the result of a successful cast into your Make Bursh From Texture node.

I just had the same question and your solution works great. Thank you!