I have an animation of a rather largish character of 15 frames. Due to the size and number of frames, all of them won’t fit onto one atlas without them being scaled down by half. Of course, placing this in the scene means the character is half the size, and scaling the game object up makes the quality look aweful.
The warning screen states that i should share some of the sprites in the animation across multiple materials/atlases. How do I do this?
You could always scale up the texture size to fit more sprites on it unless you are already at the 1024 limit (2048 with Unity 3 IIRC). This will impact performance. Its a tradeoff. Find the best compromise between quality and texture size.
I agree that you should look for a middle ground. However, I figured there must’ve been a solution given the warning notice that SM2 gave me when creating the atlas.
what i did in Puppet war for the weapons was to spread animations over a couple of sprite atlases each with its own material, both in the same place…and just switch between them when one part of the animation has finished.
so if i have a reload animation that dosent fit one atlas i do something like this:
var SpriteReload01 : PackedSprite;
var SpriteReload02 : PackedSprite;
function Reload01(){
SpriteReload01.gameobject.active = true;
SpriteReload02.gameobject.active = false;
SpriteReload01.PlayAnim(0); SpriteReload01.SetAnimCompleteDelegate(Reload02);
function Reload02(){
SpriteReload01.gameobject.active = false;
SpriteReload02.gameobject.active = true;
SpriteReload01.PlayAnim(0); SpriteReload01.SetAnimCompleteDelegate(Idle);
}
Yep, it’s in JavaScript. I recommend that method as well. There’s also the SuperSprite class you can try
Although I didn’t use the game.object = true method. What I used the hide function inside sprite manager itself e.g.:
SpriteReload01.Hide(false);
OBT: How did you set it to be a gameobject? Did you have to make a second var e.g. var SpriteReload01 : GameObject? Wanted to see if there’s any difference to the one I used in terms of performance.
For this kind of thing, I also recommend trying out the SuperSprite script in the latest version of SM2. It will handle all the hiding, etc, of other sprites for you and you can treat multiple sprites as though they were one as far as coding is concerned. You can even spread a single animation across multiple atlases if need be. Then it is as simple as:
supSprite.PlayAnim(“My Uber Anim”);
It will show/hide the constituent sprites as needed automatically as the animation plays. See the description and instructions on the SuperSprite page of the Google group for more details.