Ejemplo n.º 1
0
    /// @cond
    public override void OnInspectorGUI()
    {
        CardboardGaze cardboardGaze = (CardboardGaze)target;

        DrawDefaultInspector();
        cardboardGaze.PointerObject =
            EditorGUILayout.ObjectField("Pointer Object", cardboardGaze.PointerObject,
                                        typeof(GameObject), true) as GameObject;

        EditorUtility.SetDirty(target);
    }
Ejemplo n.º 2
0
    private void AddCardboardGaze(GameObject cameraObject, GameObject reticleObject)
    {
        // Find existing CardboardGaze.
        CardboardGaze cardboardGaze =
            cameraObject.GetComponent <CardboardGaze>();

        // Otherwise,
        if (cardboardGaze == null)
        {
            // Add the CardboardGaze.
            cardboardGaze = cameraObject.AddComponent <CardboardGaze>();
        }

        // Remove Ignore Raycast layer from the collision mask.
        cardboardGaze.mask &= ~(1 << LayerMask.NameToLayer("Ignore Raycast"));

        // Set the Reticle as the cursor.
        cardboardGaze.PointerObject = reticleObject;
    }