- Home /
how to change the colour or opacity of a sphere
i'm a bit new at Unity, i mean i'm being taught how to use it at school and i haven't been told how to change the colour or the opacity of my object. i was wondering if someone could help me with this. please help me.
Answer by ArkaneX · Nov 15, 2013 at 12:38 PM
You have to do this via material and shader. Take a look at this tutorial.
EDIT: for glass you have to use specific shader - take a look at shaders at Unity Wiki.
You can set shader on a material, but you have to create new material first and assign it to your sphere.
I don't understand - if you did it, then you're able to change shaders. If you don't know how to change shader, please take a look at the page linked by @tanoshimi. It is explained there.
Answer by tanoshimi · Nov 15, 2013 at 12:41 PM
The visual appearance of every gameobject is determined by the material(s) assigned to it. Materials define colours, textures, and shaders that determine how the object interacts with light in the scene.
Making a material behave like glass is more complicated than simply making it (semi-)transparent - you need to consider reflection, refraction, fresnel effect, viewer and lighting angle etc. - but learning how to apply a transparent material is a good start, so try reading up on that ;)
well then can you help me make it semi transparent please
"Helping" someone implies that they're putting in a bit of effort themselves too.... did you read the links provided? What have you tried? Which bit did you get stuck on?
You need to change the shader of the material on the object to one that supports transparency. Try Transparent/Diffuse for starters. Then click to change the main colour and set the alpha channel to something less than 100%
so making it look like glass by adding a shader is how i do it?
if i were to copy and past the coding would i past it into my player object and to lower the opacity which part of the coding would i change http://wiki.unity3d.com/index.php/Transparent_Single_Color_Shader
Answer by pandolfini · Apr 02, 2021 at 03:37 PM
Go to any folder and right click. Choose "Create -> Material" and proceed to edit the albedo color to be what you want it to be. If you alter the transparency, which sounds like what you want to do, the key thing is that you have to change the material's render mode to "Transparent"--if it is set to opaque it will ignore your alpha choice on your material. Go to your object's mesh renderer, toggle "Materials," and change Element 0 to be your material by either dropping it in or clicking the little target doodad and picking your material from the list.
I'm not sure why everyone else here is a dick and provided useless links you could find yourself on Google. The point of this forum is to provide answers.
Your answer
![](https://koobas.hobune.stream/wayback/20220613121947im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Particle Animator Opacity 2 Answers
Control materials opacity. 2 Answers
How to render a sprite in the opaque pass 0 Answers
Add Colour tint onto another shader? 3 Answers
Change Colour based on movement 0 Answers