In this tutorial we will create animation loops in Maya that run continuously for Unity.
In Unity:
Mac Big Sur OS BUG workaround Download this 2019.4.17 scene, move the folder to your Desktop or working area. This file is already setup with SteamVR and the SteamVR Emulator. https://classes.dma.ucla.edu/Winter21/156/projects/generic2.zip Rename the folder to a new project name. Start the Unity Hub Select ADD Locate your renamed project folder Click on the project to start Mac errors: Do not Move any files to the trash, answer preferably Open or Cancel a lot Save the scene Quit Unity Mac: Open System Preferences->Security & Privacy Go to General tab Unlock the lock with your password Click Allow Anyway for any SteamVR apps listed, keep this running, there may be more files to fix. Restart the Unity Hub Open the project
Start Unity Hub SKIP this section if you used BIG SUR workaround, go to In Maya We are using Unity version 2019.4.17f1 for this class. Do not use Unity 2020.1.# until SteamVR fixes the bug that is in the August 4, 2020 release.
Select New Give your project a name such as B_Maya_Anim1_Tutorial
Select GameObject->3D Object->Cube Use the Cube for the floor, scale it down in the Y axis. Look at the Inspector tab on the right Scale should be around 15, .1, 15 x,y,z for the floor cube. Set Position to 0, -.05, 0 Set Cast Shadows to Off for the floor in the Inspector tab. Re-name the cube to floor in the Inspector tab.
Import plugin, Steam VR Camera and Controllers for VR SKIP this section if you used BIG SUR workaround, go to In Maya Choose the Asset Store tab next to the Scene window tab If the Asset Store says you are offline, sign out and then back in to your Unity account Type SteamVR in the search bar
 Select the SteamVR Plugin by Valve (It is free) If you have never done this select Download first, then Import
Choose Import in the store window
The Import Unity package window will pop-up Scroll down to Longbow Uncheck Longbow Scroll down to Samples Uncheck Samples Select Import Choose Accept All if there is a SteamVR error messages about Resizeable Window.
Plugins always import into the Assets folder of your project. You can always copy or delete the SteamVR folders between projects.
Put the main view window back to Scene instead of Asset Store
Select the SteamVR folder from the Project tab Select the arrow , open InteractionSystem , open Core , select Prefabs Drag the Player into the Hierarchy tab

SteamVR Camera Settings SKIP this section if you used BIG SUR workaround, go to In Maya Simulation Camera: Open the arrow next to Player in the Hierarchy  Open the arrow next to NoSteamVRFallbackObjects  Select FallbackObjects Change Position in Y to 0 Change Field of View to 90 (default 60) You should set the Player->SteamVRObjects->VRCamera to the same settings as the fallback camera.
Grab and drop the Game tab below the Scene tab to create a split view.
Select Player from the Hierarchy to position and rotate the SteamVR camera. You will see the result in the Game tab
Setup the Main Camera to be out of the way SKIP this section if you used BIG SUR workaround, go to In Maya Select the Main Camera from the Hierarchy tab In the Inspector tab: Uncheck Audio Listener Change Target Display to Display 2 Change Target Eye to None in the Inspector tab (The main camera interferes with SteamVR.)
Try your Project in Sim mode. Hit the Play button 
If you are running in Sim mode use w a s d, q r or the arrow buttons to navigate around the scene, and the right mouse to rotate the camera. Left mouse for interactions.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: In Maya: Model a simple room with some animated objects, no floor. Create poly models for the items in your VR environment. (NURBS do not work)
If you have any image texture maps place them in your Unity project-> Assets folder Assign any textures from inside Maya, using the images inside your Unity project->Assets folder.
Use Lambert Shaders, nothing else will transfer to Unity.
Animation, rotation example It can be cleaner to keep animations in separate scene files.
Move the time slider over to frame 1 at the bottom of the screen.

Select a poly object.
Use the channel box on the right side of the screen. If you do not see the channel box, hit the button upper right side of the screen.
Highlight Rotate Y in the Channel Box Use the right mouse key to bring up mini menu, choose Key Selected.
Change the End Time of the animation to 301

Move the time slider over to frame 301.
Rotate the object 360 degrees in the Y axis
Highlight Rotate Y in the Channel Box Use the right mouse key choose Key Selected.
Use this process for any channel that can be animated.
Change the End Time of the animation to 300 The loop will perfect playing between 1 and 300. Unity looks at the length of the animation from the time slider to determine length.
Select you object Select Windows->Animation Editors->Graph Editor Select Tangents->Linear this will make the timing a constant speed.

Preview the animation Move the time slider over to frame 1 at the bottom of the screen.
Right mouse over the time slider to bring up the mini-menu select Playback Speed->Real-time
Hit the play arrow on the time slider. 
Stop the playback by clicking the mouse on the red square over the play arrow.
Save Maya File to Unity Assets Save the Maya scene file into your Unity project->Assets folder You will see your models and textures appear automatically in Unity.
(Maya has a utility to send files straight to a Unity project, it saves as an FBX, the scale is completely wrong. Do not use.)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: View your Maya Animation in Unity In Unity: Select Assets in the Project tab Drag your Maya file from the Assets list over to the Hierarchy tab.
Adjust Maya file: Select the Maya file in the Assets list, select the Model section in the Inspector tab Change the Scale Factor to .3 Uncheck Import Cameras and Lights (Very important for VR, Maya camera interferes with VR camera.) Hit Apply

Switch to Legacy Animation Select your Maya Model in the Assets area Switch to the Rig tab in the Inspector on the right. Change Animation Type to Legacy (default was Generic) Hit Apply
Loop If you would like to loop your animation: Select the object that has the animation from the Assets window Change to the Animation section of the Inspector tab Change Wrap Mode to Loop (near top) Change Wrap Mode located beneath Take 001 to Loop Hit Apply
Now your animations are all set up to run continuously.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Try Running your Project Always Save your scene before playing. Hit the Play button 
If you are running in Sim mode use wasd,qr or the arrow buttons to navigate around the scene,
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Publish WebGL
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: EXAMPLES http://classes.dma.ucla.edu/Fall20/156-1/projects/examples/B_Maya_anim1_player http://classes.dma.ucla.edu/Fall20/156-1/projects/examples/C_activate_animation_player http://classes.dma.ucla.edu/Fall20/156-1/projects/examples/table_lamp_player
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: **IMPORTANT Save a spare copy of your Maya scene files and Textures in another folder away from your Unity project.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

NOT USED THIS QUARTER If the Vive VR is not working with the headset Start Steam First time use, Steam will ask you to login, you may set up an account or use the department's account: login dmaucla password UCLAdma! This login seems to hang. It should work OK if you try restarting your Unity project. Worse case reboot the computer.
Make sure the headset and controllers are connected Try wiggling the Headset. Try pressing both the round buttons on the controllers together. Make sure the hand held controllers are charged.
 Steam Status Utility will look like this if it is ready.
Reset Steam if you don't see all the icons Select the down arrow next to SteamVR  Select Devices->Reboot Vive headset There is also a menu to Run Room Setup, this should be done already
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: OBS OBS screen capture VR documentation
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|