private void UpdateScriptingDefineSymbols(XRManager script) { BuildTargetGroup[] groups = new BuildTargetGroup[] { BuildTargetGroup.Standalone, BuildTargetGroup.Android, BuildTargetGroup.WSA }; foreach (BuildTargetGroup group in groups) { string s = PlayerSettings.GetScriptingDefineSymbolsForGroup(group); List <string> defined = new List <string>(s.Split(';')); for (int i = 0; i < script.AllSDKs.Count; i++) { string sdk = script.AllSDKs[i]; if (script.EnabledSDKs[i]) { if (!defined.Contains(sdk)) { defined.Add(sdk); } } else if (defined.Contains(sdk)) { defined.Remove(sdk); } } string result = ""; foreach (string symbol in defined) { result += symbol + ";"; } PlayerSettings.SetScriptingDefineSymbolsForGroup(group, result); } }
private void Awake() { if (instance) { Debug.LogError("There can only be one XRManager. Duplicate removed from: " + this.name); Destroy(this); return; } instance = this; }
public override void OnInspectorGUI() { UpdateXRAxes(); GUILayout.Space(5); XRManager script = (XRManager)target; XRSystem system = (XRSystem)EditorGUILayout.EnumPopup("System: ", script.System); bool switchTarget = EditorGUILayout.ToggleLeft("Switch Build Target On Change", script.switchBuildTargetOnChange); script.switchBuildTargetOnChange = switchTarget; if (script.System != system) { if (EditorApplication.isPlaying) { Debug.LogError("Cannot switch systems during Play Mode."); return; } Undo.RecordObject(script, "Set Value"); script.SwitchToSystem(system); bool vrs = system == XRSystem.Standalone ? false : true; PlayerSettings.virtualRealitySupported = vrs; if (switchTarget) { SwitchActiveBuildTarget(script.System); } } GUILayout.Space(5); EditorGUILayout.LabelField("Supported External SDKS:", EditorStyles.boldLabel); for (int i = 0; i < script.AllSDKs.Count; i++) { script.EnabledSDKs[i] = EditorGUILayout.ToggleLeft(script.SDKNames[i], script.EnabledSDKs[i]); } UpdateScriptingDefineSymbols(script); EditorUtility.SetDirty(script); }