Connect to a cloud deployment
To connect your mobile device to a cloud deployment, you need to authenticate with our services.
This guide describes how to authenticate using the development authentication flow which we provide for the early stages of game development.
Start a cloud deployment
The development authentication flow allows you to connect deployments that have the deployment tag
dev_login. The following steps explain how to start such a cloud deployment:
- In your Unity Editor, select SpatialOS > Build for cloud > All workers to build all your workers and wait for the build to finish.
- Upload your workers by running the following command in the terminal:
spatial cloud upload <assembly name>
- Start your cloud deployment by running the following command in the terminal:
spatial cloud launch --tags=dev_login --snapshot==<path to your snapshot> <assembly name> <path to your launch configuration> <deployment name>
Choose how to run your mobile client-worker
See this page for more information on the different ways to run your client.
Unity Editor or Unity Remote
- In your Unity Editor, open the scene that contains your mobile client-worker.
- Navigate to your mobile client-worker GameObject and ensure the Should Connect Locally checkbox is not checked in the script’s drop-down window of the Inspector window.
- (Optional) If you want to use Unity Remote, open the Unity Remote app on your Android device that is connected to your development machine.
- Click the Play button.
Android device or Android emulator
- Start your Android Emulator in Android Studio or connect your Android device to your development machine.
- In your Unity Editor, select SpatialOS > Launch mobile client > Android for cloud.
- Play the game on your device or emulator.
As soon as you have built your Android app once, you are able to launch your app for either local or cloud deployments.
iOS Simulator or iOS device
- In your Unity Editor, go to your mobile client game object and ensure that the checkbox Should Connect Locally is not checked.
- In your Unity Editor, navigate to SpatialOS > Build for cloud. Select your mobile client-worker, and wait for the build to complete.
- In Finder, navigate to
/workers/unity/build/worker/and locate the
.xcodeprojthat corresponds to your iOS client-worker, it may be in a sub-folder.
- Open the project in XCode
- If you want to run it on a physical device, you need to follow these additional steps:
- Connect your device to your development machine.
- In XCode, click on your project. This should open the General tab for your project.
- In the General tab, navigate to the Identity section and enter a unique string for the Project Bundle Identifier.
- In the General tab, navigate to the Signing section and sign the project. For more information, see Apple’s documentation on code signing and provisioning.
- Still in XCode, select the Play button in the top left of the window.
- Play the game on your device or Simulator.