cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Quill Obj's opacity in Unity

bardflat
Honored Guest
Hi, I'm trying to change the opacity of Quill Obj in Unity by using

QuillObj_mesh.GetComponent<MeshRenderer>().material.color.a.
or
QuillObj_mesh.GetComponent<MeshRenderer>().materials.color.a.

However, it keeps showing an error with

" Material doesn't have a color property '_Color' ".

It seems like I can't control the alpha of the Quill Obj by the same way with a standard Shader.
Is there any way that I can control the Quill Obj's color?

2 REPLIES 2

MikeF
Trustee
Your code should work fine, you just need to find the appropriate shader property to set. Try selecting the shader that your material is using and in the inspector you should be able to see the property names declared at the top. Its usually not far off from "_color". Might be something like "_tint" or "_mainColor".

Theres a chance the shader has no alpha support though and in that case youl need to change shaders or modify the one you're using

bardflat
Honored Guest
Thanks for the response and sorry for I'm responding too late! It seems like the shader has no alpha as you said. I decided to simply change the material when I need to adjust alpha since I've no experience with shader :9