I’m doing a port of one of my old 2D games (java) to unity. my graphics are in spritesheets and i can load the sheet and split into a spritearray. However, per the original game i had a two dimensional array where [x,0] is the original sprite, [x,1] = same sprite but rotated 90 deg, [x,2] 180, [x,3]=270. So currently i can create and load [x,0] but can someone point me to creating the rotated copies.
I tried looking at sprite.create function but the texture parameter seems to be taking the full spritesheet png
rotation is around the centre of the sprite. i know i can do in game object rotation of the object, but then it makes porting of my original code very tiresome.
“my graphics are in spritesheets and i can load the sheet and split into a spritearray.”
What you didn’t mention; it sounds like your sprite sheet only has one set of sprites, and no rotations - yes?
It probably would be easier to have sprites as separate files and then generate rotations for each separate texture. However, that array setup doesn’t play any role in this issue, you can store the sprites you import any way you like, but 2D array won’t be serializable by Unity so it won’t be visible in inspector (list or 1D array will) = you can’t assign values to it directly.
“I tried looking at sprite.create function but the texture parameter seems to be taking the full spritesheet png”
IIRC, I have myself done reading sprite parts, and documentation seems to say so:
“The second argument rect defines the sub-texture used.”
Correct.
i could create individual sheets representing each rotation, but that sounds like extra work and was looking for options to do programatically