|[UNITY C#] Changing the sprite of an object depending on its stats||Post Reply|
|Jan 19 2017 Anchor|
|Apr 21 2017 Anchor|
I believe you would have to build each individual Sprite. Logic wise you would write a script that makes a new Sprite object, gets the Sprite image component, rolls a random number between whatever bounds you want, and finally use an if statement to assign whatever image you want depending on what it's rolls.
Unfortunately I can't go into a lot of detail as I'm pretty new to unity. Just my 2 cents, hope it helps!
|May 9 2017 Anchor|
It sounds like you're describing something like paperdolling
Here's how I'd do it:
Have a sprite for each so-called 'small element'.
Have an Empty GameObject for each 'box' that will act as the parent to all of the combined 'small elements'. (we can move this one around, and all others will move relative to it)
Have a prefab GameObject for each 'small element' (using the relevant sprite)
In a script (or scripts, however you want to do it), instantiate the 'small element' prefab as and when you need to, and make it a child of the correct 'box' GameObject (in other words, make the 'box' the parent object).
And make sure the positions of the prefab are behind/ontop of the box to make sure you can actually see the small elements!
Let me know if I can go into any more detail for you or if you think you get what I mean ^_^
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.