How to programatically enable static batching in the player settings

In the testing I have been doing, it seems that static batching needs to be enabled in the webplayer's player settings in order for it to be included in programatically generated asset bundles. This being the case, does anyone know how to enable this option via an editorscript? I can't find anything about it in the docs.

If there's no way to change it automatically, it would at least be nice to be able to detect if it was off and alert the user accordingly.

Well took some time to figure it out:

	// Enable/Disable static batching
	public void SetStaticBatchingValue(bool value)
	{
		PlayerSettings[] playerSettings = Resources.FindObjectsOfTypeAll<PlayerSettings>();

		if(playerSettings == null)
		{
			return;
		}

		SerializedObject playerSettingsSerializedObject = new SerializedObject(playerSettings);

		SerializedProperty batchingSettings = playerSettingsSerializedObject.FindProperty("m_BuildTargetBatching");

		// Not sure how these couldn't exist
		if(batchingSettings == null)
		{
			return;
		}

		// Iterate over all platforms
		for(int i = 0;i < batchingSettings.arraySize;i++)
		{
			SerializedProperty batchingArrayValue = batchingSettings.GetArrayElementAtIndex(i);

			if(batchingArrayValue == null)
			{
				continue;
			}

			IEnumerator batchingEnumerator = batchingArrayValue.GetEnumerator();

			if(batchingEnumerator == null)
			{
				continue;
			}

			while(batchingEnumerator.MoveNext())
			{
				SerializedProperty property = (SerializedProperty)batchingEnumerator.Current;

				if(property != null && property.name == "m_StaticBatching")
				{
					property.boolValue = value;
				}
			}
		}

		playerSettingsSerializedObject.ApplyModifiedProperties();
	}