# It is possible to randomize textures on a static mesh taking random image from an external folder?

**URL:** <https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580>\
**Category:** Rendering\
**Tags:** randomize-array, unreal-engine, question, texture-channel\
**Created:** [October 27, 2020, 1:20pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580 "2020-10-27T13:20:19Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pokenic99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pokenic99](https://forums.unrealengine.com/u/Pokenic99)\
**Post date:** [October 27, 2020, 1:20pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/1 "2020-10-27T13:20:19Z")

</div>

It is possible to randomize textures on a static mesh taking random image from an external folder?

Hi guys,

I need help to know if it is possible to make the faces of the cube change randomly with random textures from a selected folder of the pc using the blueprints.

when I press the buttons on the top left the faces will be changing in random textures.

thank you for your attention!

 ![320281-cube-randomize-texture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/9/0093112e56ce111f36caff602bf0c055f7e8b90a.jpeg)

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 27, 2020, 2:19pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/2 "2020-10-27T14:19:21Z")

</div>

I think this solution by Rama might be what you are looking for:

[https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/4014-39-rama-s-extra-blueprint-nodes-for-you-as-a-plugin-no-c-required?p=308966#post308966](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/4014-39-rama-s-extra-blueprint-nodes-for-you-as-a-plugin-no-c-required?p=308966#post308966)

the download links to his plugin are here:

[https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/4014-39-rama-s-extra-blueprint-nodes-for-you-as-a-plugin-no-c-required#post4014](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/4014-39-rama-s-extra-blueprint-nodes-for-you-as-a-plugin-no-c-required#post4014)

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 27, 2020, 2:27pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/3 "2020-10-27T14:27:36Z")

</div>

To make it random you could get all filenames with a given extension from a folder and put these into an array. From which you then randomly pick one.

The Rama plugin also contains a function that can do that for you:  
JoyFileIO\_GetFiles

An example:

 ![320489-edit-comment.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/3/353a44b3a10b819c0319f28c271926241f04eb1d.png)

---

<div class="post-metadata">

**Author:** ![Pokenic99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pokenic99](https://forums.unrealengine.com/u/Pokenic99)\
**Post date:** [October 27, 2020, 3:43pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/4 "2020-10-27T15:43:46Z")

</div>

ok, and is it possible to change texture in-game in real-time?

ex. I take a photo \> the photo is stored in a folder \> the image will appear by pressing the button automatically in real-time

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 27, 2020, 3:50pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/5 "2020-10-27T15:50:22Z")

</div>

I personally only tested the get files at runtime, but I don’t see why the Load Texture wouldn’t work aswell.

---

<div class="post-metadata">

**Author:** ![Pokenic99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pokenic99](https://forums.unrealengine.com/u/Pokenic99)\
**Post date:** [October 27, 2020, 5:18pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/6 "2020-10-27T17:18:29Z")

</div>

ok… last question XD  
where do I put these nodes?  
I’m trying to put them on the button and nothing change

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 27, 2020, 6:08pm UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/7 "2020-10-27T18:08:33Z")

</div>

Here I made a working example using a cube. (specify the correct folder for your pictures)

Then simply call the ApplyRandomTextureFromFolder function with the material index you want to change.

> **[blueprintUE | PasteBin For Unreal Engine 4](https://blueprintue.com/)**
>
> blueprintUE is a tool for sharing, rendering and rating blueprints for Unreal Engine 4. UE4 is a game engine which use visual scripting called blueprint.

I would set this up in the actor that you want to change textures on. And call the function from the UI.

---

<div class="post-metadata">

**Author:** ![Pokenic99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pokenic99](https://forums.unrealengine.com/u/Pokenic99)\
**Post date:** [October 29, 2020, 9:52am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/8 "2020-10-29T09:52:30Z")

</div>

I tried to replicate your blueprint but with a button of a widget but nothing happens… it says that it failed in step 2

 ![320487-blueprint-random.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/0/350da4cce4a3333de6f32baca9e3e9e79acabe2a.png)

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 29, 2020, 10:02am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/9 "2020-10-29T10:02:51Z")

</div>

That would mean there are no files with the extension “.png” in the folder you provided, since the length of the array is 0.

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 29, 2020, 10:09am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/10 "2020-10-29T10:09:50Z")

</div>

I also see I did Length - 1 , this is not needed when using Random Integer. Since it gives a number from 0 to max -1. So you’d want to remove that.

---

<div class="post-metadata">

**Author:** ![Pokenic99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pokenic99](https://forums.unrealengine.com/u/Pokenic99)\
**Post date:** [October 29, 2020, 10:24am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/11 "2020-10-29T10:24:35Z")

</div>

Ok! now it’s working!!

I removed the -1 integer and Inoticed the first node was wrong, I put the **JOY FILE IO GET FILES** instead of **JOY FILE IO GET FILES AND ALL SUB FOLDERS**

Thank you so much!! ^^

---

<div class="post-metadata">

**Author:** ![Pokenic99](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pokenic99](https://forums.unrealengine.com/u/Pokenic99)\
**Post date:** [October 29, 2020, 10:26am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/12 "2020-10-29T10:26:36Z")

</div>

![320490-blueprint-random-correct.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/d/b/bdbe651f25ccfadcc6d40dccea2b748291a0696f.png)

---

<div class="post-metadata">

**Author:** ![LogierJan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/logierjan/32/88718_2.png) [@LogierJan](https://forums.unrealengine.com/u/LogierJan)\
**Post date:** [October 29, 2020, 10:32am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/13 "2020-10-29T10:32:49Z")

</div>

Glad it worked, please accept the answer if this resolved your problem! 🙂

---

<div class="post-metadata">

**Author:** ![ShadowBr0kerz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shadowbr0kerz/32/1201558_2.png) [@ShadowBr0kerz](https://forums.unrealengine.com/u/ShadowBr0kerz)\
**Post date:** [September 2, 2026, 7:40am UTC](https://forums.unrealengine.com/t/it-is-possible-to-randomize-textures-on-a-static-mesh-taking-random-image-from-an-external-folder/473580/14 "2026-09-02T07:40:20Z")

</div>

for random from folder i just list files with file manager (or directory watcher) filter \*.png \*.jpg then pick RandRange and load async. dont use LoadObject that only works for uassets.

small tip - precache the list on BeginPlay then on button just do ImportFileAsTexture2D → CreateDynamicMaterialInstance → SetTextureParameterValue. for external images you need ImageWrapper path without file:// prefix.

i ended up using runtime directory watcher from fab [Runtime Directory Watcher — Hot-Folder File Events & Async Texture Loader | Fab](https://www.fab.com/listings/98c9d662-202c-4e78-aeb7-dbf52e7d6935) for the watching part, it fires OnFileAdded so you dont need to rescan folder every click. search fab runtime directory watcher hashem store
