- Home /
Question by
stfn2 · Jul 03, 2018 at 10:06 AM ·
shadermaterialtransparencyruntime-generation
GameObject generated during runtime is not transparent on mobile device
Hey lovely community! I hope someone out there is able to help me. I am quite a newie on unity. It took me a while till I found out how to set my GameObject transparent that I generated during runtime. Here is the Code I use:
public GameObject nextPlane;
Shader shader;
Renderer rend;
private void ColorAndTransparency()
{
rend = nextPlane.GetComponent<Renderer>();
shader = Shader.Find("Transparent/Diffuse");
rend.material.color = new Color(1f, 1f, 0f, 0.9f);
rend.material.shader = shader;
}
When I am in Playmode on my Laptop the code I have written works like I wanted it to. When I build and run the app on my mobile device the GameObject has this bright and shiny magenta color that GameObjects are having by default when they are actually having no material.
Why isnt it the same like on my laptop? And what can I do to fix this?
Thanks a lot for any help. Lovely greetings
Comment