Unity UI not working using VR Samples plugin after upgrading Unity to 5.4 or 5.5

Hello there. I have a working version of my app in unity 5.3.6 using vr samples prlugin. In my scene i have 3d game object what behave like button using vrinput.cs. I also have Unity build in buttons which works as well.

THE PROBLEM IS after I upgrade unity to higher version. I have tried 5.4 and 5.5 as well. Build in UI Buttons stop working. They dont change color on hover and doesnt respond to my clicks at all.

Is this the normal behaviour or there is a bug? I was not able to read about this anywhere in guideliness. I red in release notes for unity 5.4 about some changes but VR Samples plugin documentation says it si upgraded to the latest version of unity.

Thx for your time

In Unity 5.5, UT did something very strange: They completely disable their event input system when an application loses focus (on desktop). This means that any hover effects will only work when the game really has focus - and in VR, if your game loses focus for some reason (e.g. because you do something via the SteamVR dashboard), there’s really no way to get focus back.

Hopefully, this will be fixed in a later version of Unity - in 5.5, it’s not fixed, and I believe in 5.6 it’s also not fixed. The way to work around this is to write your own VREventSystem which overrides the stupid stuff that OnApplicationFocus(…) does in Unity 5.5 (activate a “paused” mode).

When using your own VRInput, you may also want to make sure it always is processed, regardless of any other input modules (e.g. StandaloneInputModule).

Here’s what I use - please be aware that you cannot simply copy and paste this code and expect it to work because this uses my own MotionControllerInputModule that you probably don’t have in your project, but it’s easy enough to adapt this to work with your own custom input module:

using UnityEngine.EventSystems;

namespace NarayanaGames.VR.UI.UnityUI {
    public class VREventSystem : EventSystem {

        // IMPORTANT: "MotionControllerInputModule" is the custom VR input module
        //            I am using. You'll usually want to replace this with
        //            whatever laser-pointer / VR-UI input module you are using.
        private MotionControllerInputModule motionControllerInputModule;

        protected override void OnEnable() {
            base.OnEnable();

            motionControllerInputModule = GetComponent<MotionControllerInputModule>();
        }

        protected override void OnDisable() {
            if (motionControllerInputModule != null) {
                motionControllerInputModule.DeactivateModule();
                motionControllerInputModule = null;
            }

            base.OnDisable();
        }

        protected override void OnApplicationFocus(bool hasFocus) {
            /*
             * Don't do anything, it's quite stupid to pause 
             * just because we lost focus. Think of VR :-/
             */
        }

        protected override void Update() {
            if (current != this) {
                return;
            }

            base.Update();

            // NOTE: We always want to have VR-input being processed
            if (motionControllerInputModule != null) {
                motionControllerInputModule.Process();
            }
        }
    }
}