Unity + Oculus Integration on Mac

 

How long does it take to create a test project for the Oculus Quest on Mac with Unity3D? Well fortunately it does not take very much time at all, although it will take a whole lot more time to make something decent and of interest. But if one just wanted to connect up all the equipment, it is pretty fast!

According to Rescuetime I spent 33 minutes in total in Unity in order to complete these steps on my 15″ Macbook Pro 2019, including all the downloading and importing. The writing of this documentation is probably taking far longer.

The Chinese New Year Weekend is too short! I want to spend maximum fun time with the Bean, and get some catching-up-with-sleep-time, but I also want to learn how to make something for Oculus using my Mac alone?? I found several posts online claiming to be able to teach you to set up your Oculus device in 10 minutes. HA I suppose they definitely didn’t use a Mac for these speed runs (my Mac has now decided that its new calling is to mimic the hideous sound of an airplane taking off). Still, I persist in valuing the retina display+portablity over practicality and doing everything on my Mac. Will I be forced to retreat back to using a PC again after much frustration? Let’s find out!

The Oculus is a type of Android device so have to check for Android Build Support in the version of Unity I’m using. Just created a 3D project in Unity in the version of Unity I happen to be using.

Unity Asset Store has this default “Oculus Integration”. Whilst waiting for that to download, I saw there were so many different integration packages out there for VR and more. Actually got lost browsing all the rather interesting sounding “Tools/Integrations” category on Asset Store. Which ones do the most interesting things? NO CLUE. I guess I will just try Oculus Integration first before actually trying the others.

There are several updates and Unity will need to restart, after which there will be some new Menu items for Oculus like this:

Under Edit > Project Settings > Player > XR Settings > Virtual Reality should be supported.

Another step I would add in is to preemptively remove Vulkan Graphics API, because if you don’t, it will throw up an error about XR being incompatible with Vulkan. (Alternatively, I suppose one could go into the OVR scripts which is stopping the build and find the lines where it checks for Vulkan and comment out the checks?)

So I also went to read up on Vulkan Graphics API and what it does – the internet says: “Until now, the mobile graphical interface has been using the OpenGL platform. While the platform was suitable for intense mobile applications like gaming and photography five years ago, the old platform isn’t enough to handle today’s AR/VR intensive applications. It is also not possible to pack in massive hardware in a restrained form factor for running intensive mobile applications. The Vulkan API was developed by Khronos to ensure improved graphical performance with lesser resource usage. The new API has been built from scratch for rendering console quality graphics on existing mobile hardware. What that means is you will be able to enjoy the PC-like graphics on your high-end smartphone”.

ALRIGHT BUT WE WON”T USE IT.

OH WAIT AS OF 1 FEB 2021 the internets say that Unity now supports Vulkan for Oculus Quest? ¯_(ツ)_/¯

Ok whatevers. At this point I just removed Vulkan for the time being so I can continue.

Next is to create a developer account and app ID. Now I definitely have mixed feelings about the Facebook integration, which means I have to take several precautions regarding privacy. If I was buying a VR headset only as a casual user, then the issues with forcing users to login with a Facebook account would make me reconsider getting this device. However, the reason I’ve gotten a Quest 2 is for portability in VR development. Consider all the factors on your own before getting a VR headset device!

Go to http://dashboard.oculus.com/ in a different browser and set up the Developer account.

Connect the Quest to the Mac with the usb cable. Under Build Settings > Android > the Quest should now be available as a device.

Build & Run > and when its done, you can put on the headset and it will start to load your scene. Probably could have used the prefabs to make a scene but there are some demo scenes that came with so I just loaded that first.

Wahooey a demo scene!


NEXT STEPS?

Tiltbrush? Building Tiltbrush which has gone opensource?

How does I workflow???: Workflows: The process flows you should follow

How to screenshot on Oculus Quest 2? Press the Oculus Button + any trigger button. The app needs to have permission to save to storage beforehand.

Where do the screenshots on Oculus Quest 2 go to? Turns out that the Quest is a kind of Android device so on a Mac you have to download Android File Transfer and find screenshots under Oculus > Screenshots.

The Near Impossibility of Compatibility between a Mac and the Samsung Galaxy Tab 10.1 and Samsung Pico Projector

I’ve been playing around with two devices recently, for work reasons. Both of them are incidentally Samsung devices – namely the Samsung Pico Projector SP-H03 (SGD399 Promo at EpiLife) and Samsung Galaxy Tab 10.1 (Retail Price SGD848). One thing I noticed is that although they are kinda decent products on their own, unfortunately they won’t work right out of the box with a Mac. In fact they pretty much don’t respond at all when connected to a Mac! It’s times like these that I think that Apple does it the right way when I don’t have to install a driver to print on most common printers. In this day and age, we expect the devices to be smart enough to connect up. At the very least I would expect some distant flicker of recognition or reaction from it!

These are my workarounds for connecting them to a Mac, I hope it helps someone else connect their devices to their Mac since it took me some time to figure these out. For the record, I’m using a Macbook Pro 15″ running on Mac OSX 10.6.8.


My issues with both Samsung products:

1. When you plug a mobile device into a computer, you would expect it to mount and charge, like an iPad would on any device whether Mac or Windows. Anything that requires me to install a driver/application and go through a very complicated method to access files shouldn’t have been shipped out to unwitting consumers.

2. When you plug a device such as a projector into a computer, you would expect it to be detectable without having to completely stop what you’re doing and reboot your computer.


 

How to Connect Samsung Galaxy Tab 10.1 to a Mac

I tried using Kies, Android File Transfer, and via DDMS in Android SDK. DDMS stands for Dalvik Debug Monitor Server and its Android’s debugging tool. Kies and Android File Transfer did not work AT ALL with Mac. Android SDK was a bit more hassle to install but essentially straightforward to do and most importantly, at least it works!

Screen shot 2012-05-05 at AM 12
Hopeless Kies: Infinitely spinning “Connecting…” Dialog

Method 1: Kies – FAILED

Will not connect the Galaxy Tab to my Macbook Pro via USB or Wifi. In any case, it could only transfer photos, videos, and movies, and would not have allowed any access to the file structure. It perpetually says “Connecting…” but never does.

Method 2: Android File Transfer – FAILED

Very disappointing as this was the “official” method listed in the Samsung website. For explanation, read this: “Google provide Android File Transfer and there is also a third party product called XNJB. Neither currently work and the reason for this is that they both use libmtp which is an open source implementation of an MTP Initiator. To understand why this is we need to go back to MTP. In MTP each device has a manufacturer code and device code, a list of which is maintained in the libmtp source code (take a look at music-players.h). Building the library hard-wires the device list inside it, which, at the last build of both Android File Transfer and XNJB did not include the requisite codes for the Samsung Galaxy Tab.” – Who made the decision to direct consumers to download AFT if in the first place it is certainly not going to work with the Galaxy Tab? Also, why did they not ship Kies together with the product if its their software?

Screen shot 2012-05-05 at AM 02
Also hopeless: Android File Transfer does not work in this case

Method 3: Via Android SDK – WORKS!

This was the last ditch attempt, but this method was the only thing that worked for me. You’ll want to make sure that you have Eclipse Classic (Mac OS X for 64 bit) + ADT Plugin for Eclipse + Android SDK. I followed this guide on how to install Android SDK in Eclipse and it was a breeze.

Screen shot 2012-05-05 at AM 02
Eclipse

Screen shot 2012-05-05 at AM 02

Installing Android SDK

Screen shot 2012-05-05 at AM 02

Installing ADT Plugin

While the Galaxy Tab is not connected to the computer, go to Applications > USB Debugging and make sure it is ticked so that Debugging mode will launch when the USB is next connected.

Go to the Android SDK toolkit window in Eclipse. Go to Windows > Open Perspective > Others… > DDMS.

Screen shot 2012-05-05 at AM 02
SUCCESS!!! Here’s looking at the files inside the Galaxy Tab 10.1
Now you’re in. But should we have to go to so much trouble to access the device??? I am doubtful that most will take the trouble to do this. Plus its not very pretty, is it? This method is sure to scare off most casual users, I’d imagine.


 

How to Connect Samsung Pico Projector to a Mac

Samsung Pico Projector
A friend described this device as “an obstinate pony” and I honestly could not agree any more with that description. I enjoy having a larger projection of my screen, but I must admit that it doesn’t come with much instructions, and it is hard to make it behave. For example, if you simply plug it into your mac, it won’t recognise the device. After some hair-pulling and experimenting, I have found the (almost) fool-proof method of connecting it to a Mac. I have no explanation for why this works or what is going on. BUT TRUST ME IT WORKS.

FOLLOW THESE STEPS EXACTLY IN THIS ORDER:

  1. Turn off projector and shut down your mac. Turn it off. Turn off all the power. Disconnect everything!
  2. Start by connecting projector to battery, power, and then use D-Sub Gender cable and connect projector to Mac’s USB drive.
  3. Turn on projector first, before you start up the mac.
  4. Turn on your mac next. Wait for your mac to have completely finished starting up before going to the projector and using its touch buttons to change the selected Input to “PC”.
  5. Projector should be showing the output from your Mac now. Note that you might want to switch to Mirroring if that makes it easier for you to see what is going on…