Game Development Reference
In-Depth Information
Fig 8.10 My Grove .
Unity Hands On
GPS
Step 1. Create a new Unity project. Set it to build for iPhone or
Android depending on the device you have.
Step 2. Create a new JavaScript file called getGPS. Add the code
shown in Listing 8.7 .
Listing 8.7 Obtaining GPS Coordinates
var locationFound: boolean;
function Start ()
{
locationFound = false;
iPhoneSettings.StartLocationServiceUpdates();
var maxWait : int = 10;
while (iPhoneSettings.locationServiceStatus ==
LocationServiceStatus.Initializing && maxWait > 0) {
yield WaitForSeconds(1);
maxWait--;
}
Search Nedrilad ::




Custom Search