- Home /
This question was
closed Feb 17, 2015 at 03:47 PM by
meat5000 for the following reason:
The question is answered, right answer was accepted
Question by
Raynoko · Feb 17, 2015 at 03:34 PM ·
gameobjectlightingrenderingshadowmeshrenderer
Turn off castShadow in Unity5
Hi everyone. Im trying to turn off castShadow in some gameObject. But i dont know how can i do it. In Unity4 works like this:
public class TurnOnLights : MonoBehaviour {
public GameObject[] objs;
void Start () {
for (int i = 0; i < objs.Length; i++)
{
objs[i].GetComponent<MeshRenderer>().castShadow = false;
objs[i].GetComponent<Renderer>().castShadow = false;
}
}
}
Comment
Best Answer
Answer by Raynoko · Feb 17, 2015 at 03:46 PM
i found answer:
transform.GetComponent<Renderer>().shadowCastingMode = ShadowCastingMode.Off;
In case this trips any up I had to use this version:
transform.GetComponent().shadowCasting$$anonymous$$ode = UnityEngine.Rendering.ShadowCasting$$anonymous$$ode.Off;