toggle VRSettings

Hello,
I want to be able to toggle VR with a Samsung Gear App so that I can go back an forth between a normal App and VR Mode with the Galaxy

using UnityEngine;
using System.Collections;
namespace VRStandardAssets.Examples
using VRStandardAssets.Utils;

public class EnableVr : MonoBehaviour {


	void OnMouseUp() {
			ToggleVRMode();
	}


	public void ToggleVRMode() {
		VRSettings.enabled = !VRSettings.enabled;
	}


}

But I get this error (why I added the VRAssets to the build ; ):

Assets/_Scripts/EnableVr.cs(18,17): error CS0103: The name `VRSettings’ does not exist in the current context.

I realize I will eventually have to use a raycast

Thanks

~be

According to the API reference, VRSettings is part of the UnityEngine.VR namespace, so that is the one you should be using.

Also, what is that namespace doing half-way your units? It’s missing a semi-colon, so your current code-sample wouldn’t compile anyway.

A compiling version of your script:

using UnityEngine;
using UnityEngine.VR;

public class EnableVr : MonoBehaviour
{
    void OnMouseUp()
    {
        ToggleVRMode();
    }

    public void ToggleVRMode()
    {
        VRSettings.enabled = !VRSettings.enabled;
    }
}