- Home /
Question by
the_genius · Jul 27, 2015 at 10:52 AM ·
errorshadows
ShadowCastingMode gives error
Hello,
I am trying to disable casting shadows of an object using ShadowCastingMode inside an editor window. I tried it and got an error, so I then tried the code at runtime and got the same error:
Unknown identifier: 'ShadowCastingMode'.
Using the code:
function Start () {
var renderer = gameObject.GetComponent(MeshRenderer) as MeshRenderer;
renderer.shadowCastingMode = ShadowCastingMode.Off;
}
ShadowCastingMode is an enumerator so this code should work, or have I missed something?
Comment
Best Answer
Answer by ZJP · Aug 22, 2015 at 03:55 PM
renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On ; or renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off ;
As of Unity version 2019.2.11f1, this solution is still valid.