From the course: Unity: Building VR User Interfaces

Reworking the dialog to fade in - Unity Tutorial

From the course: Unity: Building VR User Interfaces

Start my 1-month free trial

Reworking the dialog to fade in

- [Instructor] Well, that was a bit much, having the dialogue fly towards the user was quite an intense experience. Now that kind of animation could be perfectly acceptable in a rectilinear 2D UI environment. However, in VR, it's not quite that acceptable. Let's go and change our animation to something that is a little bit more acceptable, like a fade-in, this should be quite comfortable for the user. Let's navigate to the dialog. I'm going to go use a shortcut, click on the dialogue in the scene. And I'm going to go and click on the Canvas. In order to allow me to fade in, I'm going to add a canvas group. So add component Canvas, and let's go select Canvas group. Alright, now that I have my canvas group, I can go and change my animation. Let me go and select the roots of my animation. So that's going to be the alert game object in the hierarchy. You'll see here that my animation close is selected by default. That's great. Now, I want to add my alpha property first. So let's go click Add property. Go down to offset, go under canvas. Let's go find our canvas group and select the alpha, I'm going to select the other two properties, they no longer needed. So right-click on offset, and right-click on scale. And my starting close alpha is going to be zero. So now our animation is completed, there's still one or two small things I'd like to touch up before leaving this chapter. First, let's go over to the dialogue manager, you'll see that our open button is set to one. Now, that same button is being used for select on the gaze pointer. So I'm going to select the Event System. And we're going to go over here to Joy Pad Click button. Click Next. And we're going to deselect. So we're going to remove one from this list, that now is going to help with the competition between those two buttons to open and sometimes close that dialog. Alright, so now our input is all sorted out, I have one more small little surprise for you. If we click on Dialogue Manager, you'll see I have this rotation lerp value. So this rotation lerp value is going to allow me to have my dialog match where my user is looking, but do it over a period of time. So I'm going to set this to a small value 0.02. So this should be an invasive, but make sure that the user is focusing on what we want them to focus on. Now, we have all of these things set up for our dialogues, we are complete with our dialogue system. Let's have a look and chat about it in VR. Let's build and run. All right, here we are in VR, I'm going to press the A button on my right-hand controller. And up comes my dialogue. That was a very pleasing transition. And also notice that with the left value my dialogue is gently following my gaze, that's a great way to make sure that user is focusing in the right position without throwing stuff in their face. Notice also I can't click on anything except for the Okay button. Alright, we really have come a long way. We've got our HUD system that allows us to see console logging events. We've got our palette system that is attached to our hand showing us visual settings. And obviously, we've got our dialogue system. Next, we'll be taking a look at in-world UI, and specifically, the challenges with rendering 2D UI on 3D surfaces. See you there.

Contents