示例#1
0
    public override void OnInspectorGUI()
    {
        //always update serialized properties at start of OnInspectorGUI
        serializedObject.Update();

        //start listening for changes in inspector values
        EditorGUI.BeginChangeCheck();

        //reference to the slider
        VRBasics vrbascis = (VRBasics)target;

        EditorGUILayout.PropertyField(autoVRTypeProp, new GUIContent("Auto VR Type"));


        if (!vrbascis.autoVRType)
        {
            EditorGUILayout.PropertyField(vrTypeProp, new GUIContent("VR Type"));
        }

        EditorGUILayout.PropertyField(ignoreCollisionsLayerProp, new GUIContent("Ignore Collisions"));
        EditorGUILayout.PropertyField(renderScaleProp, new GUIContent("Render Scale"));

        //if there were any changes in inspector values
        if (EditorGUI.EndChangeCheck())
        {
            //apply changes to serialized properties
            serializedObject.ApplyModifiedProperties();
        }
    }
示例#2
0
    void Awake()
    {
        //insure this object class is a singleton
        //if there is already an instance of this class
        //and it is not this object
        if (_instance != null && _instance != this)
        {
            //get rid of any other instance
            Destroy(this.gameObject);
        }
        else
        {
            //make this the single instance
            _instance = this;
            //keep in all scenes
            DontDestroyOnLoad(this);
        }

        //ignore collisions between all Touchers
        List <GameObject> touchers = GetAllTouchers();
        int numTouchers            = touchers.Count;

        for (int t = 0; t < numTouchers; t++)
        {
            IgnoreAllTouchers(touchers [t]);
        }

        //ignore collisions between all Pushers
        List <GameObject> pushers = GetAllPushers();
        int numPushers            = pushers.Count;

        for (int p = 0; p < numPushers; p++)
        {
            IgnoreAllPushers(pushers [p]);
        }

        //ignore collisions between all Touchers and Pushers
        for (int t = 0; t < numTouchers; t++)
        {
            IgnoreAllPushers(touchers [t]);
        }

        UnityEngine.XR.XRSettings.eyeTextureResolutionScale = renderScale;
    }