How can I toggle shadows in scripting?

I want to be able to turn shadows on and off in scripting. Is there anyway of doing this? I have looked in quality settings, but there is no global option.
Also, where is the scripting equivalent of texture quality. I want users to be able to toggle between eighth res, quater res, half res and full res?
Any comments will be appreciated
Stormy102

Although shadows on/off is not an exposed scriptable quality setting, you could create two custom quality settings - one with shadows and one without, and switch between them using QualitySettings.SetQualityLevel.

Either that or, depending on how many lights you have in the scene, you could simply loop through them all and set their shadows property to LightShadows.None.

There is no global setting ‘just to disable’ shadows. That’s hardcoded in Unity. However, you can create two identical quality settings with one shadows enabled and one disabled, and switch between two at runtime with QualitySettings.SetQualityLevel

This won’t work if you have quality settings differently to be selected by user though.
More information can be found here: Unity - Scripting API: QualitySettings