Copy Bind Poses from Sprite in Runitme
Hello,
I am using the 2D Animation Package along with the 2D IK Package and the 2D PSD Importer package to quickly create a 2D character from a PSB file. I rigged and animated the character and everything seems to be working well.
What I wish to do is to replace the characters body parts with different images (of the same scale as the original) and maintain the Bind Poses and rig information to keep the animation running properly.
The problem is that I am unable to find where this information is stored. Is it possible to either - A. Copy this information from one Sprite to Another and replacing them this way? or B. Replace the texture inside of the sprite while maintaining the rest of the data. (I tried modifying the Texture pixel by pixel but it prompted an error that the texture is of the wrong format).
Please assist.
I am having the same issue.
I am copying trying to use a different texture with the same sprite.
IEnumerator PaintSprite(Texture2D texture, string spriteName, Action callback)
{
//Clone the default texture and apply the imported texture so that it doesnt override the original sprite material
var copyTexture2D = Instantiate(DefaultTexture);
copyTexture2D.SetPixels32(texture.GetPixels32());
copyTexture2D.Apply();
_spriteRenderer.sprite = Sprite.Create(copyTexture2D, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f), 400, 1, Sprite$$anonymous$$eshType.Tight);
//Let our optional callback function know that we've done copying Texture
callback?.Invoke();
_spriteRenderer.sprite.name = spriteName;
yield return null;
}
Once I do this, the animations stop working on the Sprite, because it seems all the bones and bind pose information gets cleared out. Anyone?
Your answer
Follow this Question
Related Questions
Cloning a Sprite with 2D Animation Preview Bones causes animation to stop working 0 Answers
2D 8-way sprite animation 1 Answer
Combining Multiple Sprites 0 Answers
2D Single frame animation 2 Answers