Changing Imported Mesh Color through code
Hello.
After either importing a mesh from Blender or creating one myself using Mesh, I can't find a way to change the mesh's code through coding. I can assign a material to it and it works fine, but I cannot change the material or color of the object through code the way I do with pre-defined meshes from Unity!
Here's what I try to do:
Import Mesh (with UVs), or create one using Mesh;
Assign a C# script that changes its color:
(...) public Color startColor; // I then assign a colour from Unity Interface
void Start(){ GetComponent ().material.SetColor ("_Color", startColor); } (...)
Play, and nothing happens!
Someone help me please! To be noted that this method would work with a normal mesh from unity.
Your answer
Follow this Question
Related Questions
Real-time effect of the wet mesh 0 Answers
Changing Color Of Image not working with non-default colors. 1 Answer
Mesh causing slowdown? 0 Answers
Shader color to texture 0 Answers
Heatmap Color Ramp on 3D model 1 Answer