How can I change the shadow-resolutions property without having to increase or decrease quality level?

Now… I know this has been asked before, but NOBODY really got an actual answer to this.

Unity doesn’t give me the variables for the quality settings for shadows quality (like soft, hard, soft+hard, shadow resolution etc…). So I thought I cheat by gathering all light sources of a scene with Object.FindObjectsOfType and change the shadow resolutions for every light in the scene. But I got trolled again (it doesn’t exist for the Light class either).

using UnityEngine;
using System.Collections;

public class ShadowsQuality : MonoBehaviour {
	
	public static int shadowsQualityLevel;
	private enum g_ShaowsQualityLevels {Low, Medium, High}
	private Light[] allLightSources;

	void Start () {
	
		allLightSources = Object.FindObjectsOfType(typeof(Light)) as Light[];
	}
	
	void Update () {
		
		switch(shadowsQualityLevel){
		case 0:
			foreach(Light lights in allLightSources){
				lights.shadows = LightShadows.Hard;	
				//WHERE IS THE SHADOWS RESOLUTION VARIABLE?!
			}
			break;
		case 1:
			foreach(Light lights in allLightSources){
				lights.shadows = LightShadows.Soft;				
			}
			break;
		case 2:
			foreach(Light lights in allLightSources){
				lights.shadows = LightShadows.Soft;				
			}
			break;			
		}
	
	}
}

Does anybody know how I am supposed to change such an important setting from a script without having to switch between entire quality levels defined in the Inspector? I know that the Slender: The Arrival team made it somehow (you can customize every single setting in that game, from AA and AF to global shadows quality etc etc etc…).

It would be pathetic to make the users not be able to change the single settings and force them to switch between one global quality state (like, for example GRAPHICS: On/Off or GRAPHICS: Low, Medium, High XD).

Hello,

Simple answer: You can’t. For some odd reason Unity does not allow you to change certain quality settings at runtime.

Here is a workaround: http://forum.unity3d.com/threads/182101-Enable-or-disable-shadows-and-set-shadow-quality-at-runtime

Hope this helps,
Benproductions1

Ps: Yes I found the answer through a google search :stuck_out_tongue:

If you came here for a simple solution, there is none.
This feature has been posted on the feedback page, you might want to vote on that so that it hopefully gets implemented :
http://feedback.unity3d.com/suggestions/allow-shadow-quality-to-be-changed-at-runtime-via-scripts