public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            base.OnInspectorGUI();

            // We will only ask if we have a focus manager in our scene.
            if (EditorGUI.EndChangeCheck() && FocusManager.Instance)
            {
                FocusManager.AssertIsInitialized();

                if (canvas.isRootCanvas && canvas.renderMode == RenderMode.WorldSpace && canvas.worldCamera != FocusManager.Instance.UIRaycastCamera)
                {
                    userPermission = EditorUtility.DisplayDialog("Attention!", DialogText, "OK", "Cancel");

                    if (userPermission)
                    {
                        canvas.worldCamera = FocusManager.Instance.UIRaycastCamera;
                    }
                }

                if (canvas.renderMode != RenderMode.WorldSpace || !userPermission)
                {
                    // Sets it back to MainCamera default
                    canvas.worldCamera = null;
                }
            }
        }
 private void Start()
 {
     FocusManager.AssertIsInitialized();
     m_Canvas = GetComponent <Canvas>();
     if (m_Canvas.renderMode == RenderMode.WorldSpace)
     {
         m_Canvas.worldCamera = FocusManager.Instance.UIRaycastCamera;
     }
 }
示例#3
0
        private void Start()
        {
            FocusManager.AssertIsInitialized();
            Debug.Assert(Canvas != null);

            if (Canvas.isRootCanvas && Canvas.renderMode == RenderMode.WorldSpace)
            {
                Canvas.worldCamera = FocusManager.Instance.UIRaycastCamera;
            }
        }
    private void Start()
    {
        started = true;

        InputManager.AssertIsInitialized();
        FocusManager.AssertIsInitialized();
        GazeManager.AssertIsInitialized();

        AddInputManagerListenerIfNeeded();
        FindCursorIfNeeded();
        ConnectBestAvailablePointer();
    }
        public override void OnInspectorGUI()
        {
            EditorGUI.BeginChangeCheck();
            base.OnInspectorGUI();

            // We will only ask if we have a focus manager in our scene.
            if (EditorGUI.EndChangeCheck() && FocusManager.Instance)
            {
                FocusManager.AssertIsInitialized();
                bool removeHelper = false;

                // Update the world camera if we need to.
                if (canvas.isRootCanvas && canvas.renderMode == RenderMode.WorldSpace && canvas.worldCamera != FocusManager.Instance.UIRaycastCamera)
                {
                    if (EditorUtility.DisplayDialog("Attention!", DialogText, "OK", "Cancel"))
                    {
                        canvas.worldCamera = FocusManager.Instance.UIRaycastCamera;
                    }
                    else
                    {
                        removeHelper = true;
                    }
                }

                // Add the Canvas Helper if we need it.
                if (canvas.isRootCanvas && canvas.renderMode == RenderMode.WorldSpace && canvas.worldCamera == FocusManager.Instance.UIRaycastCamera)
                {
                    var helper = canvas.gameObject.EnsureComponent <CanvasHelper>();
                    helper.Canvas = canvas;
                }

                // Reset the world canvas if we need to.
                if (canvas.isRootCanvas && canvas.renderMode != RenderMode.WorldSpace && canvas.worldCamera == FocusManager.Instance.UIRaycastCamera)
                {
                    // Sets it back to MainCamera default.
                    canvas.worldCamera = null;
                    removeHelper       = true;
                }

                // Remove the helper if we don't need it.
                if (removeHelper)
                {
                    // Remove the helper if needed.
                    var helper = canvas.GetComponent <CanvasHelper>();
                    if (helper != null)
                    {
                        DestroyImmediate(helper);
                    }
                }
            }
        }
示例#6
0
        private void Start()
        {
            FocusManager.AssertIsInitialized();
            Debug.Assert(Canvas != null);

            if (Canvas.isRootCanvas && Canvas.renderMode == RenderMode.WorldSpace)
            {
                Canvas.worldCamera = MixedRealityCameraManager.Instance.GetComponent <Camera>();
            }
            if (Canvas.isRootCanvas && Canvas.renderMode == RenderMode.ScreenSpaceCamera)
            {
                Canvas.worldCamera = MixedRealityCameraManager.Instance.GetComponent <Camera>();
            }
        }