Lab3 : implement roll-a-ball on mobile phone

Disclaimer : Labs and Lectures concern the course Human Computer Interface which I follow with my M2 "Virtual and Augmented Reality" at IPParis. 

This lab is more tricky than the previous one and have less documentation, that's why I will try to detail all I do.

Unity Part

1] Open Unity Hub to add Android modules, you go in 'installs section', select the version you are working with (I only have one) and click on Add Modules :


Tick "Android Build Support" and wait for the end of the download. Now we open our previous project : Roll-a-ball. Go to Edit > Preferences > External Tools > all need to be tick and without errors:

If you have any issues don't hesitate to consult Forum and Docs from Unity which are very useful.

In File>Build Settings, you select Android then switch platform, the Unity logo need to be on the android line, like this :

If it's good you can open "Player Settings...>Player" which is the last thing to configure.
  • In Other Settings, remove Vulkan from Graphics APIs (by clicking on it and press "-", then in Identification make sure minimum API level is the lowest one (level 19 for me) and Target API Level is Automatic.
  • In Publishing Settings, we will create a password, it's the signature of your app and you must do it to published it in the AppStore. You click on Keystore manager, if it's the first time you need to create a ".keystore" with you own password than add a key to it with an alias and click on "add key". That's it !


  • You could also modify settings in Icon and Resolution and Presentation to personalise your app (Orientation, Icon) 

Congrats ! We just finished how to setup our computer, now we will go on our Android smartphone.

Phone part

2] I attached a video of every step you need to do on your smartphone (it's a huawei mate 20) :

Steps will be similar on others smartphones (including 7 taps on Build number to become a developper). After that your device need to appear in the list Run Device

Congrats ! You can build and run your game on your mobile device ! But as you see you cannot play it : our actual input is linked to a keyboard. We will change that by using the smartphone's gyroscope, let's write some scripts.

3] We first add a boolean isMobileBuild to notice if we use the app on mobile or on PC, all our changes will appeared after the condition "if (isMobileBuild)". As I said last time don't hesitate to open Unity's documentation.

And

Congratulation ! Your game is ready ! 



If you want to come back to our previous version (PC one) just untick "Is Mobile Build". Project and code are available on my github.

Bonus : configuration of Unity Remote

Unity remote permits to test your game without building it on