Unity Google VR Cardboard Deployment on iOS and Android

Click here to load reader

  • date post

    29-Jan-2018
  • Category

    Technology

  • view

    124
  • download

    3

Embed Size (px)

Transcript of Unity Google VR Cardboard Deployment on iOS and Android

  1. 1. Lecture 5: Finish the Game & Deploying to iOS and Android for Google Cardboard Dr. Kobkrit ViriyayudhakorniApp Technology Limitedkobkrit@iapp.co.th ITS488 (Digital Content Creation with Unity - Game and VR Programming)
  2. 2. Show Score on GameOver Scene When you change the scene. All useful game objects are gone. Make ScoreCount survive the next scene. Add DontDestroyOnLoad(g ameObject); in the Start Method.
  3. 3. ScoreCount Keep Creatings When User Press "Play Again?"
  4. 4. Solve by ScoreAbsorber Create a new ScoreAbsorber GameObject in Scene #3 (Gameover scene) Create a new C# Script ScoreAbsorber.cs Drag the ScoreAbsorber.cs to associated with GameObject Write down the following code.
  5. 5. ScoreAbsorber.cs
  6. 6. Exercise 1: Display Score on GameOver Create a new GameOverScoreDisplay C# le. Create a new Text item. Associate between GameOverScoreDisplay and Text. Find the ScoreAbsorber and update the text.
  7. 7. Importing the Asset Model 1. Download Asset Model at https://www.dropbox.com/s/ q9xup1axi5m8lm8/Asset-Pack.zip? dl=0We gonna import the asset model from Joongly. http://joongly.com/index.php?route=product/product&product_id=62
  8. 8. Importing Package 2. Assets > Import Package > Custom Package... Choose "ShootHoopKit.unitypackage" 3. Make sure that select everything and then select "Import" 4. Now you get Assets of the "ShootHoopKit"
  9. 9. Add Ringboard into the Scene 1. Drag and Drop "RingBoard" 2. Make it position correctly by using "Move", "Rotate", "Scale"
  10. 10. Exercise 2: Build Level from Assets. Duplicate the RingBoard Prefab for another 2 board Position them correctly around your scene. Remove the unnecessary block. Replace the ball that gets shot.
  11. 11. 1. Duplicate the RingBoard Prefab for another 2 board. Position them correctly around your scene. And play. 2. Drag and drop the Ball prefab to "Ball Launcher" And "Play" **Adjust Ball Speed to make it playable**
  12. 12. Adding the Trigger 1. Remove all unused Target blocks Select Them > Delete 2. Right click at the Ringboard and create empty.
  13. 13. 1. Rename it as "Trigger", Move it at the hole of the Backboard, and Add Box Collider 2. Check "IsTrigger" 3. Add the new C# le "GoalTrigger" 4. Drag and drop code to the Trigger.
  14. 14. Have the following code...
  15. 15. Exercise 3 Play button, to test the game. Duplicate it to multiple backboard Make the score to increase become public and adjustable in Unity.
  16. 16. Google Cardboard Deployment
  17. 17. We need the newest version of Unity Install the newest setup of the following les Unity-2017.2.0f3.pkg UnitySetup-iOS-Support-for-Editor-2017.2.0f3.pkg UnitySetup-Android-Support-for-Editor-2017.2.0f3.pkg Android-Studio-IDE-171.4408382-mac.dmg Xcode 9.1
  18. 18. Download the Previous Lecture Code http://github.com/kobkrit/VR_basketball
  19. 19. Build Unity for iOS Install Unity iOS Build Support Reopen the Unity & Switch Platform Xcode Use the following Apple Developer ID Username: kobkrit@gmail.com Password: SIITsiit1
  20. 20. Install iOS Build Support 1. Open File > Build Settings > iOS > Click on "Open Download Page" 2. It will download the package. 3. Follow the install instruction. After completed, Restart the unity again.
  21. 21. 4. Select iOS > Tap Switch Platform 5. It will take a while 6. Press Build and Run, It will prompt you for enter the iOS project directory. You can select any folder.
  22. 22. 7. If you encounter the API update Required Press "I Made a Backup. Go Ahead!" 8. This will take a while... 9. When it is nished, the Xcode will show up. Go to tab "General" > Select "Unity-iPhone". In Signing and Team Selection Box, Click at "None" and then "Add an Account..."
  23. 23. 10. Write down your apple ids username and password Use the following Apple Developer ID Username: kobkrit@gmail.com Password: SIITsiit1 11. You will see the above error, make change on the Bundle identier to "com.kobkrit.{your-student-id} Example: com.kobkrit.4722791763 and then press "Tab" You will see as below.
  24. 24. 12. Redo it again for "Unity-iPhone Tests Target" Select a Team 13. Plug-in your iPhone to machine. Select it as the target. And press "Play" button
  25. 25. Enabling VR 1. Open File > Build Settings > iOS > Click on "Player Setting" 2. At the XR Settings, Check at the Virtual Reality Supported Then press +, Choose "Cardboard"
  26. 26. 3. Press "Build And Run" again. 4. Re-assign Developer Team in Xcode, and Re-enter App Identier. Hit "Play" Button.
  27. 27. Build Unity for Android Install Unity Android Build Support Install Android Studio Download & Install Android SDK Enable USB Debugging on Android Device Connect Android Device to the SDK Cong Android SDK Path in Unity
  28. 28. Install Android Studio To install Android Studio on your Mac, proceed as follows: 1.Launch the Android Studio DMG le. 2.Drag and drop Android Studio into the Applications folder, then launch Android Studio. 3.Select whether you want to import previous Android Studio settings, then clickOK. 4.The Android Studio Setup Wizard guides you though the rest of the setup, which includes downloading Android SDK components that are required for development. That's it! The following video shows each step of the recommended setup procedure.
  29. 29. Enable Android USB Debugger Settings > About Phone > Build number > Tap it 7 times to become developer
  30. 30. Enable Android USB Debugger #2 Settings > Developer Options > USB Debugging
  31. 31. Install Unity Android Build Support 1. Open File > Build Settings > Android Click on "Open Download Page" 2. It will download the package. 3. Follow the install instruction. After completed, Restart the unity again.
  32. 32. 4. Plug in the Android phone to machine via USB cable. Press "Player Settings..." 5. Look at the right, At the Other Settings > Identication, Make change the Package Name to com.Kobkrit.BasketBall Change Target API Level to Android 7.1 Minimum API Level to Android 6.0
  33. 33. 6. Select Android Change Build System -> Gradle (New) Enable Development Build Press Build And Run 7. Save the Android Project to any location you like. 8. It will take a while..