store a sprite as a copy of another but rotated.

store a sprite as a copy of another but rotated.

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

i.e i want

sprite obj [x,0] = sprite;
sprite obj [x,1] = sprite rotated 90 deg
sprite obj [x,2] = sprite rotated 180 deg
sprite obj [x,3] = sprite rotated 270 deg

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.

Many thanks

@yellsellsg

“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

But how about that sprite sheet parameter? Didn’t work?