[Blueprint] variable to reference object
hi ! i want to change an object texture to a random texture. all the textures are "named" as numbers (0001, 0002 etc...). i generate a random int and then... converting it into a string is not enough nor is converting that string to asset reference ("not compatible with texture reference")
so, is there a way to concatenate a var and feed it as a reference ?
asked Apr 14 '16 at 05:06 AM in Blueprint Scripting
So, I don't think it's possible do it from string. It's not like html where you can dynamically load content and stuff it in.
The key is to make an array of textures at the begin play or constructor and then pick a random in the array before assigning to it to your set texture parameter value. It will give you the maximum flexibility later because you can compress those textures independently in the Editor.
That said if you really want to use a random int instead, nothing stops you from finding that int as string in the array...
Hope this helps :)
answered Apr 14 '16 at 08:20 AM
Create an array called Texture Reference, set it to Texture variable type. Create Texture variable, set it to Texture type. Set up all the variables and populate the array. Then use a random integer to pull a random value out of the array. Something like this:
answered Apr 15 '16 at 02:01 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here