Huh, then I wonder what's wrong. I'm doing this (where target is a game object with a blank mesh meant to hold the head shot, and "this.gameObject" is the object containing the customized spine avatar):
target.GetComponent<MeshFilter>().mesh.vertices = this.gameObject.GetComponent<MeshFilter>().mesh.vertices;
target.GetComponent<MeshFilter>().mesh.uv = this.gameObject.GetComponent<MeshFilter>().mesh.uv;
target.GetComponent<MeshFilter>().mesh.uv2 = this.gameObject.GetComponent<MeshFilter>().mesh.uv2;
target.GetComponent<MeshFilter>().mesh.uv3 = this.gameObject.GetComponent<MeshFilter>().mesh.uv3;
target.GetComponent<MeshFilter>().mesh.uv4 = this.gameObject.GetComponent<MeshFilter>().mesh.uv4;
target.GetComponent<MeshFilter> ().mesh.colors = this.gameObject.GetComponent<MeshFilter> ().mesh.colors;
target.GetComponent<MeshRenderer> ().material.shader = this.gameObject.GetComponent<MeshRenderer> ().material.shader;
And not only are none of the colors copying over, but only the default colorless male hair copies over, even when the customized avatar has its head attachment changed from "Hair_M" to "Hair_F" and colored blond. I must be missing something obvious?
Variants I've tried:
-used color32 instead of color
-used a meshCombiner
-used .sharedMesh instead of .mesh
-copied the source color from the source mesh into a separate array before copying it to the target mesh
(and it should be taken for granted, but both meshes do use the same material)
11 Dec 2016, 01:21
Okay, I figured it out. I was doing all that right after the lines where I actually set the slot attachments and colored them, before the coloring was completely finished.