I’m somewhat new to Unreal and I’m just trying to throw myself in. I’m trying to create a background for the main menu using some old grass sprites, and I’ve figured I will use the sprite actors. However, I’ve gotten confused as to how to automate randomly assigning textures to each sprite instance.
[Attached: first SS is what materials I have, important for my question are the Grass sprite and the GrassRandom blueprint class. then the 2nd and 3rd SS’s are of the contents of the Blueprint.]
I was trying to make the GrassRandom blueprint class a part of the Grass sprite (which has all 6 sprites I’m using in it btw), so I could duplicate instances of the Grass sprite and have them all work the same, but I couldn’t even do that like I thought I could. Then, pictured in the 2nd SS, I’m having trouble just figuring out how to create an array to insert the random integers from 1 to 6.
I would just look up a tutorial, but I don’t really know where to start. There are probably several key mistakes or misconceptions that I don’t even know lol.
I would greatly appreciate any help. Thanks.
here is an example: I created a blueprint with 6 child components class Sprite:
then I have an array with the different sprites I want to choose from:
and I run this to choose random sprites and apply to each
results:
First of all, thank you! Sorry I’m not getting to this until now.
I have a few questions:
- I couldn’t create child components for the GrassRandom blueprint class I originally created as a child class of Actor Component. Is the reason I can’t create child blueprints because of this type? What type of blueprint class should I use then?
- When I was initially trying to create an Array, I couldn’t put sprites in it. I created a “Niagara Data Interface Int32 array”, I’m assuming it doesn’t work because it only takes integers, but how do I make one that holds sprites?
- Not sure if you have experience with Scratch, but when I used Scratch I could make clones of something that would have the same or set behaviors as its parent. Is the equivalent to this an Instance, and if so can I create Instances automatically instead of having to make, like, 80 in the editor that all just have slightly different transform values and a different random texture?
Thank you.
so what you want is add grass to the scene? If so there are better ways to do so, not instancing a lot of actors to make grass…
No sorry I meant the grass sprite that I’ve been using so I could have them all up in a rectangle for a main menu, think Minecraft type thing with dirt blocks. I tried using tilesets/tilemaps but they were kind of frustrating and I don’t know if it would have even been possible to do the random thing with those textures with tilemaps.