Hi,
So its been a few years since I used UE/Blueprints and for the life of me I cannot work out a more efficient way to generate a procedural sprite selector that has 2 potential sized sprites.
Let me explain. So lets say I’m making a Street scene. The Street contains fences (512x512), houses (1024x1024) and each block contains 10 units to spawn (any unit could be a fence or a house). I have made a Struct containing all my Names (Fence 1, Fence 2, House 1, house 2 etc) for a total of 12 potential assets. Now in a new BP add my Struct as an ENUM variable 10 times and make them public (called “Enum Buildings 001, Enum Buildings 002” etc).
So what I am currently doing (I know this works but it does not seem like the most efficient way to do this) is using a switch from my Enum Building 001, I am then adding a ‘Paper Sprite Component’ and ‘Setting sprite’ for each output of my Enum switch.
Next, I’m checking if the first Selected Enum = 'Fence 001 or Fence 002) and if it does I am setting the transform of the second Enum (Enum Building 002) to x512, if false it sets the it to x1024. Nice and simple. but this becomes a right mess now that I have to check each iteration for multiple results… for example, If 1st is ‘Fence’ spawn 2 at 512. if 2nd is ‘Fence’ spawn 3rd at x1024 but if 2 is ‘House’ spawn 3rd at x1536. If the 1st is a 'House" and the second is a “House”, spawn 3rd at x2048. and so on and so forth. as you can imagine by the time I get to the 10th, this is gonna be a nightmare.
Here are some screen shots to help illustrate the issue…
I hope you can see what I’m talking about. Please bare in mind that it has been a good few years since I have done BP and I was never an expert
Thanks for any help.