I have a simple cube.
My shadows dissapear after I add this code
newMat = Resources.Load("tiled", typeof(Material)) as Material;
cubed.GetComponent<Renderer>().material = newMat;
cubed.GetComponent<Renderer>().material.color = thecolor;
If I add it manualy in editor its got shadows. Whats the difference? I got no shadows.