Я уже некоторое время борюсь с этой проблемой - по сути, у меня есть объект TMP_Text. Затем (как в примере 23 TMP) я устанавливаю цвета вершин персонажа в указанный цвет. Однако когда я перемещаю объект TMP_Text, все цвета персонажа сбрасываются. Вот соответствующий код, который устанавливает цвет символа, а также видео, отображающее это поведение :
private void ChangeColor(int i, Color32 c)
//changes color of the letter that is @ specific index to a color32
//this is getting called elsewhere in the script
{
int materialIndex = tf_.characterInfo[i].materialReferenceIndex;//get characters material index
cols = tf_.meshInfo[materialIndex].colors32;//get its colors
int vertexIndex = tf_.characterInfo[i].vertexIndex;//get its vertex index
cols[vertexIndex + 0] = c;//set vertex color to C
cols[vertexIndex + 1] = c;// ^
cols[vertexIndex + 2] = c;// ^
cols[vertexIndex + 3] = c;// ^
ms_.UpdateVertexData(TMP_VertexDataUpdateFlags.Colors32);
//update the vertex data to render the new colors
}
public void scrollContent()//this moves the TMP_Text object
{
sr.verticalNormalizedPosition = 0;//scroll the rect to the bottom
//performing this^ movement changes the objects position, thus resetting all the colors.
}
}