Publish VR  PC Only

Install OpenVR XR Plugin to run a VR Headset
This plugin interferes with WebGL publish.
Do this at school at a computer with a VR headset.

Transfer your project to the desktop of the PC with VR at school.

Select File->Build Settings...

     Select PC, Mac & Linux Standalone
Select Switch Platform
Close the window

Window->Package Manager
     Change to Packages: In Project
          Under the +, upper left
               Select Add package from tarball...
               Locate the com.valvesoftware.unity.openvr-1.1.4.tgz tarball file in your project folder.
                    (I added a copy to the template.)

          OpenVR XR Plugin should be installed (near the top)

If you did not find the tarball you may download from: OpenVR
Click Latest button to download:   com.valvesoftware.unity.openvr-1.1.4.tgz tarball file
XR Plug-in called OpenVR Loader or OpenVR XR Plugin.
(There is a copy in the main project folder of this template.)

You can see what the file installed by opening Edit->Project Settings
    XR Plug-in Management
         Initialize XR on Startup is selected
          OpenVR Loader is selected

Fix Bindings, if there is a problem
Delete the Assets/SteamVR_Input folder in your project.
     Answer yes to generate actions, Save and generate, close window   (This will create a folder in Assets called SteamVR_Input)

Make sure the Player is at 0,0,0

Turn off SteamVRSimulatorColliderHelper, located in the Hierarchy

Universal Render Pipeline Settings
Select the UniversalRenderpipelineAsset from your Assets
Use the Inspector to change:
     Change Anti Aliasing (MSAA) to 4x (default none)
     Change Render Scale to 1

     Select Cast Shadows for Main Light and Additional Lights
     Shadow Resolution 1024 for all lights
Cascade Count to 4
     Select Soft Shadows

Select the UniversalRenderPipelineAsset_Renderer from your Assets
Check to see if this is already done.
     Select Add Renderer Feature
          Try adding Screen Space Ambient Occlusion
               Intensity .2   (default 3)
               Radius .5     (default .035)

Add Hover Events to objects with the Door Open Scripts
Click events only works with mouse clicks for the simulator.
The animated object needs a collider.

Use Add Component

     Search for inter
     Select Interactable Hover Events

Hit the + under On Hand Hover Begin () in the Inspector

Drag and drop Maya Model from the Hierarchy onto None (obj) in the Inspector

Click the drop down menu reading No function

     Choose BackAndForthAnimation->ToggleOpen

Interactable Script in the Inspector
     Turn off Highlight on Hover

Do NOT use for webGL.
Teleporting can not be experienced with the simulator and it gets in the way for WebGL publishing.

Drag in the Teleporting prefab
from SteamVR->InteractionSystem->Teleport->Prefabs->Teleporting into the Hierarchy tab.

Create a floor, GameObject->3D Object->Cube.

Make a Plane for the teleport area. GameObject->3D Object->Plane It should be located just above anything that has a collider such as the floor.

Add the Teleport Area component to the plane
     Select the plane, use Add Component
          search for tele select Teleport Area
This will allow the player to teleport anywhere along this plane.

SteamVR Setup
Start up Steam Game browsersteam_VR1

Then start the SteamVR program by clicking on the VR in the upper right corner.
(You can close the Community windows)


If the Controllers are not being seen by the Base Stations, Select Pair Controller from the Controllers menu under the controller icon.

Testing the Vive
Put on Headset
Use the controllers to launch the SteamVR library simulation

Room Setup and Chaperone
Open SteamVR from the TaskBar  steam_VR_taskbar
Select Menu steam_menu
     Select Room Setup
     Select Room-Scale
     Make sure the Headset Controllers and Base Stations are visible in the menu.
     Click NEXT
     Pull the trigger on a controller while pointing at the monitor
     Place both controllers on the floor flat side down
     Create some boundaries, select Advanced Mode
     Click each corner of the room

Select Menu steam_menu
     Select Settings
          Select Play Area->Chaperone style FLOOR ONLY
          Slide the Color to the right (no color)
               Slide Transparency to the left, (transparent)

If the Vive VR is not working

Some of the control boxes have a power button.

Make sure the headset and controllers are connected
Try wiggling the Headset and pressing the buttons on the controllers
Make sure the hand held controllers have charged batteries

Steam Status Utility will look like the image above if it is ready.

Reset Steam if you don't see all the icons
     Under the Menu icon steam_menu
     Select Devices->Restart headset

Hide the mouse cursor & add an Escape button
You might already have this script applied to the Player camera if you used the URPtemplate
Select the Main Camera or an object
Select the Add Component button in the Inspector
     Scroll down to New script
          Type a name: hide_cursor_escape
          Double click the new C# script in your Assets folder

Replace entire script with this script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class hide_cursor_escape : MonoBehaviour
    // Use this for initialization
    void Start()
        Cursor.visible = false;
    // Update is called once per frame
    void Update()
        if (Input.GetKeyDown(KeyCode.Escape))

Publish your project to a Unity Player
File->Build Settings...
     Select PC, Mac & Linux Standalone
     Select Switch Platform
     Select Build And Run
          Locate your Publish folder (or make one)
               Make a new folder that matches your Project folder name

Use Esc or Alt F4 to quit the player. You will restart it later.

Quit Unity

Use OBS to capture your screen.

© 1988-2022 34 years Jennifer Steinkamp