simple UI menu and canvas for DK2 - unity3d

I am using Unity 5.1.2p3 with DK2 SDK 0.6.0.1 and I understand from this post that Screen Space - Overlay is not supported in Unity VR. It is recommended to use Screen Space - Camera (which in my case does not work) or World Space (which I am using now) but I need someone to help me understand how I get simple menu with buttons and toggles to show as a still image and how I can make selections and button presses with my mouse cursor.
I have created a menu for my app, with 4 toggles and 1 button. When I check the Virtual Reality Supported option with the Oculus being in Direct Mode and Canvas being in World Space, I can see it in VR, but I cannot see/find my mouse cursor to tick one of the toggles.
When I take off the headset, on my monitor's Game View tab, I can see and even use the mouse and select a toggle. Obviously, I have to keep the headset steady, so in my Game View, things do not shake!
Another thing I notice is that the VR camera is the same as the Main Camera in the Unity Hierarchy, but when I take off the headset and move it around, the position of the camera does not change, only looking up and down and around is reflected.
How do I simply do a static menu like a 2D surface that does not move in VR and a user can use button presses and muse clicks with the headset on? What settings are required for this way of doing UI and canvas stuff? There are 2 attachments, showing my current settings...

Are you specifically wanting to use the mouse? If you look through a blog entry I wrote below, it will show you how to use Gaze looking to trigger menu buttons:
http://talesfromtherift.com/vr-gaze-input/
You can achieve this by some code I list there that raycasts from the center of the screen and if it hits any UI, it will trigger the correct events and make it clickable by button (or by time).

Related

In unity how to make in-game menu?

I'm making a Unity2D mobile game but I'm stuck on making a menu. I want the in-game menu and if the player touches the screen or clicks the screen, the game will start and the menu will be have store, options but I don't know how to do it. I tried to do the same scene but this time when it goes to the next level, the menu disappears. I searched on the internet but couldn't find it. Thanks.
You should first create a UIManager script for yourself.
In this script, you must define 2D elements such as Text, Canvas, Panel and provide their functionality.
Then you can control these functions in your main manager (GameManager).
To put it simply, it takes almost a video tutorial to explain it.
Because this is not a simple code error question, man.

Unity - Screen overlay canvas is visible through wall

How do i properly use Overlay Canvas so that it is not visible over walls. As seen in the image below the canvas is seen through the wall(the white line in Game view). I am using a free roam camera that you can freely move in the Game. I tried using Screen Space - Camera canvas but when i move my camera in Game the edges are flikering.
What you are seeing in your game view is the "Gizmo", which shows the canvas outline. If you disable gizmos in the game view (top right of the game view, just click the "Gizmos" text", the white line will no longer be visible. This wouldn't show in a build of the game even if you have it enabled in your editor.
As Robin said, what you're seeing is just the canvas gizmo in the scene view. It's so big because it's scaled in world units to the resolution of your game view.
If it's getting in your way you can hide it without disabling it or turning off gizmos by clicking the little eye icon in the left of the hierarchy. The little finger icon will disable selecting it by clicking in the game world, so it doesn't get in the way of trying to select other objects.
If you're using an older version of unity, you may need to just disable the canvas and remember to turn it back on before you build, or disable gizmos.

UE4 Enabling Mouse During Play?

I'm extremely new to UE, and doing a few easy tutorials to get started, so I don't exactly know the correct terminology to use to help me find what I am looking for... Anyway, whenever I hit play and the game starts, my mouse disappears and I am only able to use the input that I set up; so my question is, even though I do not need mouse input for movement, as I am using WASD, how do I keep my mouse unlocked and available to move around without being locked to the camera?
When you hit play and the game starts, your mouse gets captured by the game to control the camera. If your play button is set to play in the viewport, you can release the mouse from the viewport by pressing Shift-F1. The game will still be running, but input (including from the keyboard) will be suspended and you can interact with the editor.
You can also change the default behavior of how the mouse is captured and it if is constrained to the viewport boundaries. To see these options, go into the project settings (settings button above main viewport/project settings...). On the left side of the project settings window, select 'Input' under the Engine heading. On the right side will be some mouse preferences that can change its behavior.
For instance, to allow the mouse to travel outside the viewport, change 'Default Viewport Mouse Lock Mode' to 'Do Not Lock'. I don't recommend this, but you might experiment with these to get a feel for what they do. Also, you might look up these settings in the Unreal documentation for more detail.
There are 3 blueprint nodes that change the input method:
Set Input Mode Game
Set Input Mode Game and UI
Set Input Mode UI
You want a combination of the second one and a "Show Mouse Cursor" node. However, if you are making an FPS and you use the mouse to look around, you may lose that ability with the second node above. It comes down to what your game is and how you want to use the mouse.
I had the similar issue. So I did something like this in Level Blueprints to achieve what I want.

Google VR Unity SDK - Unable to Detect Touch in VR Mode

I am using GVR Unity SDK Version: 1.1 with Unity 5.5.0f3. I need to display a button similar to the Gear Icon that is rendered by the Google VR SDK. This button should accept touches and should be visible at all times. The issue with using a Button created in the Unity Canvas is that it does not process touches because the GVR Input Module takes precedence over the StandAlone input Module.
I have looked at the google vr sdk code and have found that the gear icon is rendered using OpenGL calls in the PostRender.cs file but still am not able to find where the touch is processed. Beyond this I am stuck as I dont have much knowledge of OpenGL.
My question : How do I render a button on top of the existing UI (so that it is visible at all times just like the gear icon) and get it to accept touches (by calling a function in my code).
I know that you have to do some recasting from the controller to the UI. There is a demo scene called "Scrolling UI". Try checking there to see if there is something that can help out.
I'm not a hundred percent sure, but just some advice to the right direction.
Hope you find your answer!
The simplest way I found for enabling regular touch inputs on top of the VR scene is to use a Screen Space - Overlay canvas with a regular Graphic-Raycaster and add a Standalone Input Modul to the EventSystem game object.
This way the buttons in that canvas are clickable.
Hope it helps.

Pause/Freeze a scene with a trackable active in vuforia unity 3d

I am developing an app with vuforia Cloud Recos. I want to add the feature of allowing the user to pause the page so she does not have to keep pointing the device on the target to view the trackable. This is pretty useful when I want to show texts. Is there anyway to achieve that on Unity3D ? A good example is Microsoft's Here City Lens app which includes a button to pause the page as the screenshot shows;
You could take a screenshot of the screen and apply it to an Image UI object. That is if you do not need the camera feed anymore.
If you need interaction with the elements, I would only take a screenshot of the camera feed without items. Get AR camera transform, apply it to a new camera, disable AR camera.Then apply the screenshot to a background plane covering the whole screen. Keep items on as well and they do not listen to Vuforia anymore. You are pretty much recreating a basic Unity scene. The items should not be moving with Vuforia, the camera is. So they are still in the middle and you need to know where was the camera when you took the shot. Your scene is complete