private void SetScreen(FlowCoordinator _activeFlowCoordinator, CustomViewController newViewController, VRUIViewController origViewController, bool right, bool immediately)
        {
            string        method     = right ? "SetRightScreenViewController" : "SetLeftScreenViewController";
            Action <bool> backAction = (immediate) => { _activeFlowCoordinator.InvokePrivateMethod(method, new object[] { PopViewControllerStack(right), immediate }); };

            _dismissCustom += backAction;  // custom back button behavior
            if (!newViewController.isActivated)
            {
                if (right)
                {
                    _rightViewControllerStack.Add(origViewController);
                }
                else
                {
                    _leftViewControllerStack.Add(origViewController);
                }

                if (newViewController.includeBackButton)
                {
                    newViewController.ClearBackButtonCallbacks();
                    newViewController.backButtonPressed += () => { backAction.Invoke(false); }; // default back button behavior
                }
                _activeFlowCoordinator.InvokePrivateMethod(method, new object[] { newViewController, immediately });
            }
        }
 /// <summary>
 /// Sets up the left CustomViewController.
 /// </summary>
 /// <param name="viewController">The viewcontroller to set.</param>
 /// <param name="includeBackButton">Whether or not to generate a back button.</param>
 /// <param name="DidActivate">Optional, a callback when the ViewController becomes active (when you open it).</param>
 /// <param name="DidDeactivate">Optional, a callback when the ViewController becomes inactive (when you close it).</param>
 public void SetLeftViewController(CustomViewController viewController, bool includeBackButton, Action <bool, VRUIViewController.ActivationType> DidActivate = null, Action <VRUIViewController.DeactivationType> DidDeactivate = null)
 {
     leftViewController = viewController;
     leftViewController.includeBackButton = includeBackButton;
     if (DidActivate != null)
     {
         leftViewController.DidActivateEvent += DidActivate;
     }
     if (DidDeactivate != null)
     {
         leftViewController.DidDeactivateEvent += DidDeactivate;
     }
 }
        private void SetScreen(FlowCoordinator _activeFlowCoordinator, CustomViewController newViewController, VRUIViewController origViewController, ViewControllerPosition pos, bool immediately)
        {
            Action <bool> backAction = (immediate) => SetViewController(_activeFlowCoordinator, PopViewControllerStack(pos), pos, immediate);

            _dismissCustom += backAction;  // custom back button behavior
            if (!newViewController.isActivated)
            {
                if (!_viewControllerStacks.ContainsKey(pos))
                {
                    _viewControllerStacks[pos] = new List <VRUIViewController>();
                }

                _viewControllerStacks[pos].Add(origViewController);
                if (newViewController.includeBackButton)
                {
                    newViewController.ClearBackButtonCallbacks();
                    newViewController.backButtonPressed += () => { backAction.Invoke(false); }; // default back button behavior
                }
                SetViewController(_activeFlowCoordinator, newViewController, pos, immediately);
            }
        }