which details getting sprites sliced up at runtime, thanks to Seregon’s answers, and is how we can get an autoslicer for indie users.
I am tinkering with it myself but if anyone comes up with a working version for that completes the process (actually chops up the images as a sprite rather than cut them into their own unique image) then by all means post back and upload what you got working for the rest of the community to benefit from!
I’ll check back in a day or two and if I get one going I’ll upload it here.
Hrmm… felt like more would be interested… apparently im the last guy still using indie unity
Anyway I came up with a test to try and stop it from creating all separate files for each sprite, and instead using the built in unity sprite atlas deal job, this is what I have came up with but, doesn’t seem to work yet. Any ideas?
void CutSprites(Texture2D input, List<int[]> Islands)
{
//Texture2D[] output = new Texture2D[Islands.Count];
Vector2[] outputPos = new Vector2[Islands.Count()];
Vector2[] outputDim = new Vector2[Islands.Count()];
int i = 0;
foreach (int[] coords in Islands)
{
int width = coords[2] - coords[0];
int height = coords[3] - coords[1];
//Texture2D sprite = new Texture2D(width, height);
//Color[] pix = input.GetPixels(coords[0], coords[1], width, height);
outputPos[i] = new Vector2(coords[0], coords[1]);
outputDim[i] = new Vector2(width, height);
//sprite.SetPixels(pix);
//sprite.Apply(true);
//output[i++] = sprite;
Sprite.Create(input, new Rect(outputPos[i].x, outputPos[i].y, outputDim[i].x, outputDim[i].y), Vector2.zero);
}
//return output;
}
wait… what? I must be extremely confused haha, ok yes your totally right. I have been under the impression that only pro users could auto slice a sprite. Wow there goes a couple days worth of effort for nothing hahaha - Ok thanks TomasJ for enlightening me :X
Just because it says you cant click the button doesn’t mean you shouldn’t try
But no in all honesty that feature works you just dont have access to unities sprite atlas creator.