Você está na página 1de 4

What's A training day?!

Introduction & Installation


01- SETTING UP SDKs and BUILD SETTINGS
02- SETTING UP GVR POINTER,CAMERA AND ETC.
03- SETTING UP THE ENVIRONMENT
04- SETTING UP CHARACTER CONTROLLER
05- SETTING UP START BUTTON
06- ADDING FINISH LINE
07- RESETTING ON FINISH
08- TIMER
09- BUILDING IT TO ANDROID DEVICE

Phase 1
*SETTING UP SDKs and BUILD SETTINGS
-On File, click Build Settings > On Platform Select Android > then Switch Platform.
-On assets, select Import Package> Custom Package. Then locate the Google VR SDK on
SDK folder. Import All.

-Click on Player Settings.


-On Inspector, go to Other Settings. Enable Virtual Reality Supported >
then on Virtual Reality SDKs, click "+" and select Cardboard.

Phase 2
*SETTING UP GVR POINTER,CAMERA AND ETC.

-Locate GVREditorEmulator prefab in the Project panel Google VR > Prefabs folder
-Drag into Scene or Hierarchy
-Ensure it is at Position(0,0,-2) in Transform
-Drag Main Camera to Camera in GVREditorEmulator Script in the Inspector.
-Locate GVRReticlePointer prefab in the Project panel Google VR > Prefabs > UI
folder
-Drag into MainCamera in the Hierarchy
-Select Main Camera on the Hierchy,
-Add Component > GVRPointerPhysicsRaycast in the Inspector.
-On Hierarchy, click Create > UI > Event System
-Select Event System on the Hierarchy
-Add Component > GVRPointerInputModule in the Inspector.
-Again, Add Component > GVRPointerManager.
-Move Standalone Below GVRPointerManager and GVRPointerInputModule on the Inspector

*To try if the Pointer is running


-Create a 3D object > Cube
-Ensure it is at Position(0,0,3) in Transform
-Select the Cube, on the Inspector, click Add Component > Event Trigger.
-On Project, create a material > chage its albedo to green.
-Drag the material to the cube.
-Play.
-Stop.
-Delete Cube.

Phase 3
SETTING UP THE ENVIRONMENT
-Locate Maze 1 prefab in the Project panel Prefabs folder
-Drag into Scene or Hierarchy
-Ensure it is at Position(0,0,0) in Transform
-Locate StartCube prefab on the same folder
-Drag into Scene or Hierarchy
-Ensure it is at Position(0,3,3) in Transform
-Save you Scene(CMD-S/ CTRL-S)
-Name it MazeVR

Phase 4
SETTING UP CHARACTER CONTROLLER
-GameObject > Create 3D object > Capsule.
-Set the Position to (0,1,0) in Transform.
-Rename Object to Player
-Set the Tag to Player in the drop-down in Inspector.
-Add Component > Physics > RigidBody
-Freeze X and Y Rotation in RigiBody > Constraints.
-Select Player on the Hierarchy.
-Create Empty .
-Rename Object to EyeLevel.
-Drag Main Camera to Player Gameobject to make it a Child.
-Set the Position of EyeLevel to (0, .75, 0) in Transform.
-Make Sure the Main Camera position is Set to (0,0,0) in Transform.
-Select Player on the Hierchy.
-Add Component > New Script > Name it "AutoWalk" > Select Csharp >Create and Add.
-Double-click the icon of the AutoWalk script to open it in the Script editor.

//insert code screenshot here//

Phase 5
SETTING UP START BUTTON
-Select StartCube on the Hierarchy.
-Add Component > EventTrigger.
-Add Component > New Script > Name it "StartGame" > Select Csharp >Create and Add.
-Double-click the icon of the StartGame script to open it in the Script editor.

//insert code screenshot here//


-Drag Player gameobject to Player in StartGame script in the Inspector

-Add New Event Type in Event Trigger in Inspector.


-Select PointerEnter.
-Click "+" > Drag StartGame script to None(Object)
-Click No Function > StartGame > OnPointerEnter
-Add New Event Type in Event Trigger in Inspector.
-Select PointerExit.
-Change the Function to StartGame > OnPointerExit.

Phase 6
ADDING FINISH LINE
-Expand Maze 1 on Hierarchy
-Select Finish 1-3
-Set the Tag to "finish" in the drop-down in Inspector.
-Add tag > Set new tag name to "finish" > Save.
-You can now see the tag "finish" in the drop-down in Inspector.
-Select Finish 1-3
-Add Component > New Script > Name it "Finish" > Select Csharp >Create and Add.
-Double-click the icon of the AutoWalk script to open it in the Script editor.

//insert code screenshot here//


-Drag Player gameobject to Player in Finish script in the Inspector
Phase 7
RESETTING ON FINISH
-GameObject > Create Empty.
-Rename Object to SpawnPoint.
-Set the Position of EyeLevel to (0, 0, 0) in Transform.
-Open AutoWalk script.
-Uncomment this Lines.
//insert code screenshot here//

Phase 8
TIMER
-GameObject > UI > Text.
-Rename Text to Score.
-Set the Anchor position in the Rect Transform to the Top Center preset
-Set Position X to 0 and Position Y to -50
-Change Width to 300 and Height to 40
-in the Text component, set the Text to "Time: 0"
-Set the Font size to 40
-Set Alignments to Center and Middle
-Set both Horizontal and Vertical Overlow to Overflow.
-Select Canvas> Select WorldSpace on RenderMode
-Set Scale to (0.15, 0.15, 0.15)
-Set Position to (-0.1,-0.3,2.98)
-Set Width to 800 and Height to 400.
-Add Component > New Script > Name it "ScoreManager" > Select Csharp >Create and
Add.
-Double-click the icon of the AutoWalk script to open it in the Script editor.

//insert code screenshot here//


-Drag Timer to Score Text in ScoreManager script in the Inspector
-Open AutoWalk script.
-Uncomment this Lines.
//insert code screenshot here//

-Select Player in the Hierarchy.


-Drag Timer to Score in AutoWalk script in the Inspector.

-File > Save Scene, File > Save Project


-Press Play to Test your game.
-Go get out of the Maze! Enjoy!

Phase 9
BUILDING IT TO ANDROID DEVICE
-File > Build Settings > Add Open Scenes.
-Click on Player Settings.
-On Inspector,Change the Company Name to "GoogleIO" and Product Name "MazeVR"
-Go to Other Settings. Change the Package name to com.GoogleIO.MazeVR
-Cange Minimum API level to API level 19.

-On your Phone, Enable Developer Mode.


-Go on Settings > Locate Build number> Click it 7 times.
-Go on Developer options> Enable Usb Debugging
-Connect to you PC/Laptop/Mac
-Go back to Unity.
-Build and Run.
-Name your APK to "MazeVr"
-Insert your Phone to Google Cardboard.
-Get the F*ck out of the maze!

Copy 'GoogleIO' Folder from the USB Stick,

Open Unity, File > Open Project


Open 'GoogleIO'

Você também pode gostar