This will allow GPU instancing for any number of animations by setting the appropriate uv.z to index the slice you want to animate.
I did this by passing textureSize into the private IEnumerator CreateAllAnimationTexturesForRig(Vector2Int[] sizes, int vertexCount, int fps, AnimationClip[] clips, GameObject original, Vector2Int maxSize) {
Here is the relevant changes.
for (int clip = 0; clip < clips.Length; clip++) {
Texture2D result = new Texture2D(maxSize.x, maxSize.y, DefaultFormat.HDR, TextureCreationFlags.None);
Debug.Log(sizes[clip].ToString());
float clipTime = clips[clip].length;
int frames = sizes[clip].y;
//Color[] clearColors = new Color[sizes[clip].x * sizes[clip].y];
Color[] clearColors = new Color[maxSize.x * maxSize.y];
This will allow GPU instancing for any number of animations by setting the appropriate uv.z to index the slice you want to animate.
I did this by passing
textureSize
into theprivate IEnumerator CreateAllAnimationTexturesForRig(Vector2Int[] sizes, int vertexCount, int fps, AnimationClip[] clips, GameObject original, Vector2Int maxSize) {
Here is the relevant changes.