technical architecture.

GearVR dev batch scripts

by on Oct.27, 2015, under Batching, Oculus, Uncategorized, Unity3D

There’s a small array of .bat files that I’ve found myself accumulating over the last bit while I’ve been developing a GearVR and unity app.

A couple of the more useful scripts that tend to live in my build folder. (The ones that haven’t migrated to being editor scripts within unity that is.

Super simple one, take whatever file you drag onto the bat file in windows explorer and try and push that to the device.


adb install -r %1

Fetch the public IP of the current device that is connected via USB, turn on tcpip mode on the device, and connect to it. (While storing the last IP used in a local DeviceIP.txt file


adb shell ip addr show wlan0 | for /f "tokens=2 delims= " %%A in ('findstr /R /C:"/23"') do echo %%A > temp.txt
for /f "tokens=1 delims=//" %%F in (temp.txt) do echo %%F > DeviceIP.txt
adb tcpip 5555
for /f "tokens=1 delims= " %%p in (DeviceIP.txt) do adb connect %%p:5555

Use the last IP stored in the DeviceIP.txt file, and disconnect from remote ADB use.

for /f "tokens=1 delims= " %%p in (DeviceIP.txt) do adb disconnect %%p:5555

Clear the logcat, handy for minimizing how much log you need to scan through.

adb logcat -c

Capture/fetch the adb log to a file, log_output.txt in the same directory that you run the batch from. this will filter the log output for the standard Oculus and Unity line items only. (As of 10-2015.)

adb logcat -s "Unity","VRSVC","VRApplicationPolicy","DEBUG","OVR","TimeWarp","VrLib","VrApi","UnityPlugin","HmdSensors" > log_output.txt

remove the > log_output.txt portion at the end if you want to just draw the log to the console, which can be handy once in a while, when you want to drink from the firehose. For the extra feisty Firehose, remove the -S “” filters.

Note, if you’re trying to use any of these outside of a .bat file, and directly in the console, convert any DoublePercentages %%A to Singles %A.

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!