Guide On How To Build Unity Project On Windows For iOS

Made by Nima Jamalian

Table of Contents

Step 1

Unity ID

Make sure you have made a Unity ID, if you don't have one you can click on the link bellow and make an account.

https://id.unity.com/en/conversations/5b084117-1746-4386-ae3c-dc2b7a9ef7fc01bf

Sign in with your Unity ID to Unity Hub

Open Unity Hub → Top right corner → Click on Avatar Icon → Sign In

Set 2

Create a GitHub

In order build Unity iOS application on Windows, we are going to need to use GitHub. Click on the link bellow and create a GitHub account.

GitHub: Where the world builds software
GitHub is where over 65 million developers shape the future of software, together. Contribute to the open source community, manage your Git repositories, review code like a pro, track bugs and features, power your CI/CD and DevOps workflows, and secure code before you commit it.
https://github.com/

Download GitHub

Next step is to download GitHub application and install it on your Windows computer. Click on the link bellow to download the application.

GitHub Desktop
Checkout branches with pull requests and view CI statuses See all open pull requests for your repositories and check them out as if they were a local branch, even if they're from upstream branches or forks. See which pull requests pass commit status checks, too!
https://desktop.github.com/

Once you downloaded the application sign in to your account inside the GitHub app.

Step 3

Create Apple Certificates

⚠️
Note: for this section you need to have apple developer account or be part of a team that has apple developer account. University can provide you with apple developers account by adding your iCloud account to University developer account so you don't need to buy one.
⚠️
You also need to install git for Windows, click on https://gitforwindows.org/ and download the application and install. Follow the default installation setting you don't need to change any thing. Once the installation has finished you should have a application called Git Bash. If you open it you should get a Windows similar to picture below.

Create a new fold call it Apple Certificates → Right Click on it → Git Bash Here

⚠️
If you are on Windows 11 → Right Click on the folder → Show more options →Select "Git Bash Here"

Create key

Now we need to create .key file, in order to that run the following command in Git Bash that we opened.

openssl genrsa -out YourApp.key 2048

Yous should get a message similar to below

And a new file called YourApp.key should be created in your Apple Certificates folder.

Now run the command bellow

⚠️
Note the code highlighted in red you need to change that with your information youremail → Write you email here (This should be iCloud email) yourname → Write you name here GB → Set your region if you are in the UK leave it as GB
openssl req -new -key YourApp.key -out YourApp.certSigningRequest -subj "//emailAddress=youremail, CN=yourname, C=GB"

This command will create another file in your Apple Certificate Folder called "YourApp.certSigningRequest"

Now go to Apple developer console click on link bellow

Sign in with your Apple ID
Sign in with your Apple ID
https://developer.apple.com/account/resources/certificates/list

Go to Certificates → Click on Plus icon to create a new certificate →

Select Apple Development ("This covers building application for iOS, macOS and etc.") → Click on Continue

Now we need upload the YourApp.certSigningRequest file that we created this should be in your Apple Certificate Folder. Once the file uploaded click on continue.

Apple will generate a certificate for you. Then you can download this. Click on Download.

The file downloaded is called "development.cer" move this to Apple Certificate Folder.

Create an Apple ID for your app

Go to apple developer console → Identifiers section → Click on Plus Icon → Select App IDs → Click on Continue → Select App for Type → Click on Continue →

fill in the information

Description: WRITE YOU APP NAME HERE

Bundle ID: com.yourname.appename (don't use capital word here) App ID Prefix → Select you team ID

Example:

once you have filled the information click on continue. Click on Register. Now you should be able to see your app in the identifiers section.

‼️
Write these information we are going to need them later. Bundle ID App Name Team ID

Adding our phone as a tester device

Go to apple developer console → Devices section → Click on pulse icon →

Select Platform → For iPhone set to → iOS, tvOS,watchOS

Device Name → Give it a name

Device ID → Now we are going to learn how to get our phone UDID

Open the link below

https://appforshare.io/get-udid

Scan the QR code in this website using your iPhone.

A website will open on your phone → Click on "Click for your UDID"

This will download a profile into your phone. → Go to Settings → General → VPN & Device Management → Select Get you UDID Profile

Click on install. After installing a web page would open that show your device UDID save that.

After this you can go back and delete the profile we just installed on phone since we don't need it any more.

Now enter the UDID in Apple developer console and click on continue and add you device register your device. This allows us to install our application on the device.

Creating Provisioning Profile

Go to apple developer console → Profile Section → Click on Pulse Icon → Select iOS App Development → Now you need to chose App ID → Select the App ID you created in the previous section → Click on continue → Select the apple development profile that we selected previously → Select your mobile device → Give the Provisioning Profile a name for example "YourName Profile" → Click on Generate → Click on Download → A new file will get downloaded with .mobileprovison extension → Move this file to our Apple Certificates folder

Creating .p12 certificate

Git Bash to Apple Certificates folder → and run the bellow command

openssl x509 -in  development.cer -inform DER -out YourApp.pem -outform PEM

This will create a file called "YourApp.pem" in our Apple Certificates folder

Now we are are to create .p12 certificate folder, this will require you to enter a password. Make sure you remember this password as we need to use later.

⚠️
Chane 0 to your password
openssl pkcs12 -password pass:0 -export -inkey YourApp.key -in YourApp.pem -out YourApp.p12

This will create a file called "YourApp.p12" in out Apple Certificates Folder.

🎉
Finally we have everything ready for build!! 😅

Step 4

Create/open your Unity project.

Create a Unity project, we are going to use this project to build for our iOS device using Windows and Unity. If you already have a Unity project you can just open that.

Setting up project Build Setting

Click File → Build Setting → Player Settings → iOS Section → Other Settings → Go to Identification section → select Override Default bundle identifier → Set your bundle identifier (we made this previously in apple developer console) → Set you Signing Team ID (You can find this in apple developer console → Member ship → Team ID) → Enable Automatically Sign In

Step 5

Activate Could Build

Instead of building project on our machine we are going to use Unity service that build iOS application using could services.

Click on → Mange Services (Button with cloud icon in Unity) → Then click on could build and turn it on

A new windows will open → here you need to select your organization → set to you account → click on create project ID

After that make sure you click on cloud build again to turn it on

Step 6

Uploading our Unity Project to Git

In order to use could build we need to upload our Unity project to a git repository.

Open Git application → Click on Add → Create a new repository

Give it a name

Chose a location for it

Select Git ignore → Select Unity

Click on Create repository

Click on Publish repository

Deselect → Keep this code private → Publish repository

Now move your Unity project to this repository

⚠️
Note after this when you open your Unity project again for the first time you need to relocate it since we change the location.

Now go to GitHub select the repository that we created → you should see some file change that is being highlighted by the GitHub

In Summary section write down project file → Click on Commit to main → Click on Push origin → Now we have uploaded our project file to out repository

Step 7

Setting Up Unity Could Build

Go to link below

Unity Dashboard
Use Unity Dashboard to develop and operate your games.
https://dashboard.unity3d.com/organizations/757893/projects/1e50ca93-6e30-49e6-b9fc-078463e66108/explore

Click on DevOps

Select you app in the bar and then select set up could build

Select GitHub → Here you need to sign to your GitHub and give unity permission to access it.

Chose the repository we created → Click on Next: TARGET SETUP

In Cofig panel Click a new Setup New Target →

Click on iOS →

Project Subfolder → This should be change to folder name of your project folder. If you are not sure open your repository and see the folder name inside

Unity version → Select the unity version which your project was made in

→ Click on Next: Credentials

Now write down Bundle ID, we created this before in apple developer console

Give your device a name.

Upload the mobile prov file and p12 file from the Apple Certificates folder.

Enter the p12 Password which we created.

Click Next:Build → Now Unity will start building your application

⚠️
This might take a while depending on the size of your project . Unity could build is a bit slow.

If build is successful you get this message

Let's make sure if your apple developer credential have been accepted by unity →

Go to Config → Signing Credentials→

If you see Provisioning Profile and p12 File marked as VALID it means your profile has been setup correctly. 🥳🎉

Checking the status of Build

In Unity dashboard just go Build History and you can see if your project has been build or not.

Build Successful, Phone Install

Once the build has been finished, if it is successful. Unity will send you an email to your email address with the link to download the application.

If you build fail Unity will tell the error message so you can try to resolve it.

Open that email on your phone → Click on Install → A web page will open → Here you need to sign in into your Unity account

Click on Install

Unity will ask you to install a profile on your phone to verify your UDID. Go to your phone setting → General → VPN & Device Management → Click on Unity Profile and install it

Now go back to the Unity page and click on install. Unity will start downloading the app and install it on your phone.

Unity doesn't really give any indication that the app is being download and installing. Wait for a bit and the app should show up in your home screen.

Click on the app and it should open!

Step 8

How to build the project again

You might add some changes to your project and might need to build it again then all you have to do push the changes to git repository we created. So just add your changes to Unity file and close Unity once you are done.

Open GitHub → Select your repository → In the Summary section write down a brief description of your changes → Click commit → Click on Push origin

This will upload the file to repository. Unity will automatically build the file every time the repository changes so you don't have to do anything.

Once the build finished Unity will send you an email. You can also check the status of build in Unity dashboard build history section.

Unity Dashboard
Use Unity Dashboard to develop and operate your games.
https://dashboard.unity3d.com/organizations/757893/projects/1e50ca93-6e30-49e6-b9fc-078463e66108/explore