To deploy your game on iOS devices, you need to connect the device to a Mac with Xamarin.
Make sure Xamarin is installed on the PC and the Mac. For instructions about how to install and set up Xamarin, see the Xamarin documentation:
Make sure your iOS device is provisioned. For instructions, see Device provisioning in the Xamarin documentation.
Make sure the iOS platform is added to your Xenko project. To do this, in Game Studio, right-click the solution, select Update package > Update Platforms, and make sure iOS is selected.
For more information about adding platforms in Game Studio, see Add or remove a platform.
Open your solution in Visual Studio.
To open your project in Visual Studio from Game Studio, in the Game Studio toolbar, click (Open in IDE).
In the Visual Studio toolbar, click .
Xamarin Agent opens.
Connect to the Mac via Xamarin. For instructions, see Introduction to Xamarin iOS for Visual Studio in the Xamarin documentation.
In the Solution Explorer, right-click the project and select Set as StartUp Project.
In the Solution Platforms menu, select iPhone to build on physical iOS devices (including iPad), or iPhoneSimulator to build for the simulator. The simulator emulates iOS devices on your machine, but has some drawbacks (see below).
In the Visual Studio toolbar, select the iOs device you want to build for.
From the Solution Explorer, open
If you want to create a release build, set the bundle identifier. This is a unique ID for your application.
If you want to deploy on iPad, under Targeted device family, click .
Speed up builds on iOS devices
It takes a long time to build on iOS devices. This is because:
the Mac needs to build code ahead of time (AOT) for the different devices
the Apple sandbox system doesn't let you update packages incrementally, so the Mac needs to completely redeploy the application on the device for every change
To compile code more quickly, in the Solution Explorer, right-click the iOS project and select Properties.
- Under Linker Behavior, select Don't link.
- Under Supported Architectures, select only the architecture of the debug device.
- Disable Strip native debugging symbols.
- Enable incremental builds (only code that changes from one execution to another is AOT)
For more information, see iOS Build Mechanics in the Xamarin documentation. For information about profiling, see Using instruments to detect native leaks using markheap.
To make redeploying each time faster, make your debug packages as small as possible.
In Game Studio, reduce the Size of the textures in your project.
Remove unused assets.
Test your scenes one by one rather than loading them simultaneously.
Debug your application on the iPhone simulator instead of a real device. However, execution is slow on the simulator and it produces some rendering artifacts, so we don't recommend using it to debug real-time graphics.
Compile shaders on iOS
As converting Xenko shaders to OpenGL shaders on iPhone devices is slow, we recommend you convert them remotely (ie in Game Studio).
Our recommended workflow is:
Execute the app on Windows. This creates the shader permutations.
Import the new shaders in Game Studio. This generates an effect log.
Save and run the game on iOS.
Ideally, this creates all the shader permutations remotely, so you don't need to convert them on the device. However, new permutations might still occur due to differences such as supported screen resolutions. For more information, including information about how to compile shaders remotely on iOS, see Compile shaders.