Extract color array
I'm attempting to extract the color data from these meshes.
So far I've been able to get the arrays for both the Vector3 points and their triangles.
I can access the main color of a mesh
private Renderer rend;
[SerializeField] private Color color1;
rend = GetComponent<Renderer>();
numbOfColors = rend.materials.Length;
for (var i = 0; i < numbOfColors; i++)
{
color1 = rend.material.color;
}
But I'm trying to get the other colors. And as I said, I need to extract the arrays that determine the colors for each triangle. Anyone have any ideas?
Answer by technofeeliak · Oct 18, 2020 at 06:30 PM
Alright, so I can reference each material and put them into a material array.
[SerializeField] private Material[] materialsArray;
private Renderer rend;
void Start()
{
rend = GetComponent<Renderer>();
materialsArray = rend.materials;
}
Now What?
Your answer
Follow this Question
Related Questions
Change transparency of many Sprites at once. 1 Answer
Depth of Field Post Processing Causes Color Banding 0 Answers
Unity standard shader emits yellow instead of orange 0 Answers
How Do I Import A model with Colors? 0 Answers
Very strange problem that occure only in Built game (not in Editor) 0 Answers