I have several items the player can wear, and each have a spritesheet so they can shift around properly during the walk animation. I loaded all the spritesheets into one SpriteCollection, and then was faced with the task of making a walk animation for each and every one.
Instead, I made a single animation prefab and then wrote a script to repurpose it for every item.
So my question based on researching similar posts: is there a reason I should be using Resources.Load instead of tk2dSpriteAnimation.Instantiate? Are there any other potential issues using this method? Thanks!
tk2dSpriteAnimator theAnimator = gameObject.AddComponent<tk2dSpriteAnimator>();
theAnimator.Library = (tk2dSpriteAnimation)tk2dSpriteAnimation.Instantiate(genericAnimationPrefab);
for (int i = 0; i < theAnimator.Library.clips.Length; i++)
{
for (int j = 0; j < theAnimator.Library.clips[i].frames.Length; j++)
{
int oldId = theAnimator.Library.clips[i].frames[j].spriteId;
int newId = TransformOldIdToNewId(oldId); // pseudo-code placeholder function
theAnimator.Library.clips[i].frames[j].spriteId = newId;
}
}