I need to spawn a hundred of planes each with it’s own texture.
I’d like the plane mesh component in my BP to autoscale in construction script, to fit the aspect of the assigned image texture. But I can’t find how to read that info. Ther’s GetWidth and GetHeight nodes to read video media files resolution, but not the equivalent for normal texture assets. AFAIK.
Haw can I do this? It would save me HUGE time setting this up.
Also tryng to find a way to load those textures at runtime, instead of manually create hundreds material instances, but that’s for a different post, I guess.
No need for a different post for the textures part.
Here is some help. Is not the perfect solution but a workaround…
You must store ALL your textures in an array of class Texture2D somewhere
then you just iterate creating dynamic material instances and replacing the textures
from that array and use @Everynone function for the scale and apply the material.
The thing is how do you create an array with A LOT of textures instead of adding one by one?
this is the workaround:
create an actor just for this purpose and create a Texture2D array inside and tick
the array as Instance Editable
throw the actor into the scene and the array will be exposed:
create an Editor Utility Widget and just add a button on it:
A video tutorial with background music LOL. This is insane.
Great. I’ll implement runtime loading. That will give the user full flexibility to change content (the images he wants to display) with no intervention on my side. I planned to implement that in further versions, but if it’s so easy I’ll make it in this 1st approach.