How to disable Mesh Render Shadow on specific object?

Hello,
How to disable Mesh Render Shadow on specific object? (Using a code of curse)
Thanks all for help!

1 Like
myGameObject.GetComponent<MeshRenderer>().shadowCastingMode = ShadowCastingMode.Off

There is no: ShadowCastingMode.Off;

ah, you need to include

using UnityEngine.Rendering;

at the top of the script, or use

 ... = UnityEngine.Rendering.ShadowCastingMode.Off;
1 Like

It Works, Big thanks bro!

Can you help me bro with another thing?
How to make the GameObject able to move in distance from 0 till 3?

Vector3 MousePosition = new Vector3(Input.mousePosition.x, Input.mousePosition.y, Distance);

Thanks for help!

I not too sure what you mean, but if you mean “change distance over time from 0 to 3” you’re probably looking at a Lerp function.

also conventionally variables are lowercase first letter, Classes and Functions are uppercase first letter :slight_smile:

Can you give me an example fo a Lerp Function please?

going to pass that one off to google; Lerp is something of a sticking point for newbies and there are loads of examples and how to’s on it.

Have you got skype bro?