
Development of code-based UE4 projects for iOS on Windows
- From the sandbox
- Tutorial

One of the most frequently asked questions on the official Unreal Engine 4 forum regarding iOS development is the ability to develop code-based projects on Windows without having to buy and use Mac OS X as required by official documentation. There are solutions, but they are poorly designed and can take a lot of time for trial and error. There is no need to talk about the difficulties of translating into Russian. So this tutorial was born, which I want to share with you.
For starters, not a lot of facts. UE4 officially allows developing games for iOS only on Mac OS X and Xcode, respectively. Agree, especially in our country, to buy a powerful Mac comparable in performance to an existing PC, it’s quite an overhead. Yes, and not everyone wants to retrain for a new OS and development environment, but if they decide, they will spend a decent amount of working time on it before reaching the previous level of efficiency.
I’ll make a reservation right away that it will not work completely without a computer (PC or Mac) running OS X, at least in the current version of the engine. However, there is a rather optimal and compromise solution to the problem. Already, all users of the latest versions of the engine (4.2.x and higher) who have access to its sources on GitHub (or, for example, downloaded them with the well-known torrent tracker), have an undocumented ability to configure a computer running Mac OS X as a server assembly and compilation of projects, and the very development of the project and its testing on devices lead exclusively from under Windows. You only have to look periodically at the Mac and check whether it still works or if you loose it all by constantly compiling the code.
What is needed for this?
As already mentioned, you will need a computer running Mac OS X (10.8 and higher). You can buy a used Mac or Mac Book or run OS X in a virtual machine. How and on what your OS X will work is up to you. As an example, we are currently using the Mac Mini (Late 2009), which we bought cheaply. He copes with his tasks, but in the future we will definitely put the machine faster (the most important is the processor and disk system). It makes sense to look for a computer on ebay (unless of course you have time to wait with delivery for 2-3 weeks; we didn’t have it).
So, suppose that we have everything we need, namely: a working PC running Windows (7 SP1 and above), as well as a computer running OS X (10.8 and higher). Computers must be connected to a regular local network. In theory, the proposed method is as follows. In the sources of UE4 there is a program UnrealRemoteTool. By launching it on OS X, we will be able to send commands to execute it from a remote computer (compile, pack, etc.). In our case, commands will be sent from a PC running Windows and on which development is underway in UE4: content is edited, project code is written, etc. In the net, after the correct configuration, we can directly compile and package the project for iOS directly from the UE4 editor, just like in the case of a regular PC build. From there You can install ready ipa on all iOS devices connected to your PC. The following is a detailed instruction on how to configure all programs and equipment on both systems. Go
Step 1: First, we need to access the sources of UE4. If you already have them from unofficial sources, then you can skip this step. If you are an officially registered developer of Unreal Engine 4 and have an active subscription, then you need to do the following. Go to the GitHub website and register there if you do not already have an account. Enter under it. Next, go to the Unreal Engine website - log in there and in the account settings (Account section) specify your GitHub account in the corresponding line. Save the changes. Next, your journey lies on the Epic Games GH page on GitHub: github.com/EpicGames/- In the list of repositories, select UnrealEngine. In the upper right corner, click the Fork button, and in the window that appears with the choice of account, select your GitHub account. Make sure version 4.2 and older is retrieved. After that, you will be taken to the page of your personal engine branch. It is recommended that you read the entire description on the page before moving on, but the main thing you need to do here is download the two archives Required_1of2.zip and Required_2of2.zip , which are in the section Getting up and running. It remains to download GitHub clients for local work with sources. For Windows, you can download it here , and for OS X here .
Next, for each operating system, you need to perform your own set of steps separately. Let's start with Mac OS X, and finish the setup already on the PC, after which you can freely develop for the iOS platform.
Mac OS X
Step 2: First of all, you need to update the system to at least version 10.8, and preferably to the latest version of Maverics (10.9.x). In the upper left corner, click on the apple, select About This Mac -> Software Update. You will be moved to the AppStore and if updates are available, install them.
Step 3: Then install Xcode. It is free, you can download it from here .
Step 4: In order to develop projects for iOS, you need to be registered in the Apple Developer Program. The program costs 99 $ / year. Now it has become quite easy to get developer status, you do not need to send any faxes for this. For those who are not registered yet, I advise you to start here. For those who are already registered, you need to create a certificate and a Provision profile based on it for your game, and it is also advisable to think about the AppID in order to fully be able to test GameCenter, iCloud, IAP and Push messages. All of this can be done at Member Center.. Do everything exactly with the description on the site and the process will not take you much time. Please note that to install the Provision profile on an OS X computer, just download it and open it with a double click. Xcode opens and that's it. No additional messages will appear - this is normal. With the installation of certificates on a computer, everything is a little more complicated, but nevertheless more transparent (you can see them yourself in the Keychain application after importing). The only thing is that former UDK developers who have a certificate (which can be downloaded from the Apple website) but don’t have the private and public keys that were used to generate the certificate may have problems. In this case, go to the Apple website, create a new certificate, again following the instructions, and then create a new Provision Profile based on it.
Step 5: After you import the certificate and the Provision profile into the system, you need to export the certificate and its private key back. To do this, go to Applications -> Utilities -> Keychain Access.app. In the top-left window, select login , select My Certificates below , and then find your imported certificate in the list on the right. Right click on it and select Export . First export it with the * .cer extension, and then open it, select the appeared key and export it by selecting the * .p12 extension. You will need these two files, as well as your Provision profile on the PC later, so save them to a USB flash drive or Dropbox for example.
Step 6:Now we need to pick up the source from GitHub. To do this, open the OS X terminal: Applications -> Unitilites -> Terminal.app. You can do without it, but it will be faster and much more convenient in the end. You will soon understand why.
Step 7: Go to the root directory by entering the command:
cd /
Note: If you are asked to enter a password, enter it, not paying attention to the immobility of the carriage. It should be so. Enter your password blindly and press Enter.
Step 8: Create a new folder in the root directory:
sudo mkdir UE4
Step 9: Ensure that this folder has all permissions:
sudo chmod 777 UE4
Step 10: Next, install the downloaded GitHub client on Mac. Run it, log in with your account. In the left column you will see a list of accounts from which you can download repositories: select your account. In the list of repositories that appears on the right, select * Your_Account * / UnrealEngine and click Clone To Computer . For the cloning folder, specify the UE4 folder you created earlier, located in the root directory of the hard drive.
IMPORTANT: Clearly follow all the paths and directories for cloning repositories, creating UE4 projects, etc., otherwise your project simply will not be assembled due to files not found here and there. At the moment, the system is very sensitive to changing the location of the engine source code and the projects themselves!
Step 11:Please note that previously downloaded zip files do not need to be unpacked on OS X. Only source code is needed here.
Step 12: After the sources are copied to your computer, return to the command line and run the following command:
for (( ; ; )) ; do ./UnrealRemoteTool; done
It will launch the UnrealRemoteTool utility , which from now on will listen to commands from your Windows PC. Note that we ran it in a loop. If suddenly the utility closes due to an error, for example, it will open again and continue to work. Thus, you can always keep your OS X computer on and at any time pack iOS projects using it. In case the Mac is completely turned off, you can configure it to turn on after an emergency shutdown. This is done as follows: System Preferences -> Energy Saver check the box Start up automatically after a power failure. Now, in order not to launch Terminal manually each time and not to execute the for command to start UnrealRemoteTool, execute the following set of commands in the Terminal window (you need to open a new window, since the current one is busy waiting for commands from UnrealRemoteTool):
cd /UE4/UnrealEngine/Engine/Build/IOS
sudo chmod 777 /UE4/UnrealEngine/Engine/Build/IOS
touch StartUnrealRemoteTool.command
sudo chmod 777 StartUnrealRemoteTool.command
open /UE4/UnrealEngine/Engine/Build/IOS
you will see the Finder window with the IOS directory. Locate the StartUnrealRemoteTool.command file there. Right-click on it, select the menu item Open With -> TextEdit.app
In the file that opens, write the following commands
cd /UE4/UnrealEngine/Engine/Build/IOS
for (( ; ; )) ; do ./UnrealRemoteTool; done
click at the very top, File -> Save on the left. Now open the System Preferences -> User & Groups system settings, select your account in the left window, and go to the Login Items tab from the top left. Click on the plus sign on the opened tab, go to the root and select the file StartUnrealRemoteTool.command. Thus, every time the system starts, UnrealRemoteTool will start automatically and your Mac will always be ready to go.
Step 13: In OS X, we only need to find out the name of your computer and configure Files Sharing. Go to System Preferences -> Sharing and check the box next to File Sharing . Select Allow access for All Users . At the top of the window you will see the name of your computer. Click on Editand in the window that appears, rename it so that there are no spaces in it. For example, HGSMacMini. Note the .local postfix at the end of your computer name. Write somewhere on a piece of paper the whole name along with the postfix, we will need it soon.
Windows
Step 14: To work with code-based projects on Windows and to be able to compile the engine itself from source, you need to install Visual Studio 2013 (not lower). A free Express version will do; You can download it here.
Step 15: Launch VS2013 once after installation is complete; select a theme; Choose your preferred environment configuration If you are prompted to log in, log in (you will need it if you later want to use TFS Online as a version control system)
Step 16: Next, install the GitHub client on Windows. After installation, log in with your account, and you can skip the second and third steps. Next, open the client settings (gear, top right) and in the Clone Path field, enter C: \ UE4 - clickThe Update . Now you can download the source from the Internet. Click on the plus sign in the upper left corner, go to the Clone tab . Similar to how it was done in OS X, select your account in the left column, and in the right UnrealEngine and click Clone at the bottom of the window.
Step 17: Optional: If you plan to work with TFS as a version control system, then at this stage you need to disable the selected project in GitHub, otherwise it will knock you out from under TFS, whenever you try to open the Solution project in VS2013. On the main screen of the client, the UnrealEngine project should be displayed in the left column. Right click on it and select Remove. Далее закройте GitHub, перейдите в папку C:\UE4\UnrealEngine и удалите скрытую папку .git – если она не удаляется, перезагрузите компьютер или воспользуйтесь программой анлокером и удалите ее.
Шаг 18: После того как исходники скопируются, по очереди откройте ранее скачанные zip файлы (вместо стандартной утилиты Windows, лучше воспользуйтесь WinRar или др.): Required_1of2.zip и Required_2of2.zip — извлеките их содержимое в папку C:\UE4\UnrealEngine с заменой.
Шаг 19: Далее в папке C:\UE4\UnrealEngine создайте текстовый файл и изменить его название вместе с расширением на следующее: UE4Games.uprojectdirs – откройте его в Notepad++ или в обычном Notepad и добавить в него `./` (без кавычек, только точку и слеш). Сохраните файл.
Step 20: Now go to the folder C: \ UE4 \ UnrealEngine \ Engine \ Saved \ UnrealBuildTool and open the BuildConfiguration.xml file (it is best to open this and all subsequent files in Notepad ++ so as not to damage the encoding. Carefully use the insert).
At the bottom of the closing tag (in version 4.3, this section already exists at the beginning of the configuration file - you need to edit it), insert the following xml code:
- AlternativeServer
HGSMacMini.local
заменив при этом HGSMacMini.local на название вашего OS X компьютера, которое записывали ранее. Сохраните файл.
Шаг 21: Теперь по очереди откройте два следующих файла:
C:\UE4\UnrealEngine\Engine\Binaries\DotNET\IOS\IPhonePackager.exe.config
C:\UE4\UnrealEngine\Engine\Source\Programs\IOS\iPhonePackager\Properties\iPhonePackager.exe.config
и убедитесь, что в секции присутствует следующая строка (если ее нет, ее надо вставить, или исправить false на true):
Сохраните файлы, в случае внесения изменений
Шаг 22: Перейдите в папку C:\UE4\UnrealEngine\Engine\Build\IOS и откройте файл UE4Game-Info.plist (теперь точно в Notepad++) и найдите свойство CFBundleURLName. Вам нужно заменить его на значение Bundle указанного при создании вашего Provision profile, который был установлен в OS X. Обычно он выглядит следующий образом: `com.AwesomeDeveloper.CoolGame` — без кавычек. Вместо CoolGame может быть * если у вас так был настроен бандл (на выпуск нескольких игр). Это нормально. Далее, найдите строчку:
com.epicgames.${BUNDLE_IDENTIFIER}
and replace com.epicgames with the value from your bundle, but this time intentionally omitting the name of the game. Save the file after making sure that the encoding matches UTF-8 without BOM. This can be done by clicking Encoding on the Notepad ++ menu.
Step 23: It's time to remember our certificate and provision profile. Without leaving the folder, copy your provisioning profile that was installed in OS X into it and rename it to UE4Game.mobileprovision
Step 24: It remains to import the certificate. Click on the Start button and type in the name MMC.exe in the search and press Enter. In the window that appears, click File -> Add / Remove Snap-in ... In the window that appears, in the left column, select Certificates from the list , then click Add, in the dialog box that appears, specify My user accountand click Finish and then OK. The dialog closes and the Certificates - Current User item appears in the left column of the main window. Expand it and select the Personal -> Certificates folder. Right-click on the center of the window where the certificates are displayed and select All Tasks -> Import. In the wizard window that appears, click Next. Find your certificate exported to OS X on disk, select it. Click Next and then Finish. After that, click All Tasks -> Import -> Next again. But this time, find the exported private key with the extension * .p12 by selecting it first among the filters. Then click Next, you will be prompted to set a password on it. Skip, otherwise when automatically packing a project in UE4, access denials are possible. And also click Next, then Finish. All preparatory work is completed. Close MMC.exe. On the offer to continue, refuse. This has nothing to do with certificates.
Step 25: Finally, you can run the C: \ UE4 \ UnrealEngine \ GenerateProjectFiles.bat file to generate the engine project and auxiliary programs. Once the script runs, run the generated UE4.sln for the first time (this is the solution of the engine itself). At the top, in the project settings, select Development Editor and Win64 , after watching this video first , so that there are no questions where to choose Win64. Next, in Solution Explorer, select the UE4 project, right-click on it and select Build . The engine will compile 15-40 minutes. It all depends on the processor and disk system, as noted earlier. After the assembly of the engine itself is completed (UE4 project), in the Solution Explorer, open the Programs filterand assemble the UnrealFrontend project to get the program of the same name at the output. It is useful for profiling code, as well as to avoid error messages when packing and installing projects on devices through the Launch Tool in the editor.
Step 26: Upon completion of the assembly, you can open the finished UE4 editor, which is located here: C: \ UE4 \ UnrealEngine \ Engine \ Binaries \ Win64 \ UE4Editor.exe. At the start, you will be asked to create a project. Select the Code Base Project , uncheck the Include Starter Content checkbox , and select C: \ UE4 \ UnrealEngine \ as the directory - I remind you, the directory is very important! Then click Create Project .
Step 27:The project creation window closes and Visual Studio 2013 opens with the source code for your new code-based project. All that is needed is to select your project in Solution Explorer and right-click on it to select Build.
Step 28: After compiling the project, run UE4Editor.exe again and select your project from the list. After opening, you will be taken to a map created by default suitable for testing the basic functionality of the project (the ability to build and deploy on devices). Therefore, save this map in the directory of your project. To begin with, it will serve as your starting card for packing the project. Next, go to Edit -> Project Settings -> Maps & Modes and specify in the Game Default Map fieldjust saved map. Below, make sure that the Default GameMode field contains the GameMode of your project that you created and compiled. For example IdolGameMode. If it is not selected, select it from the list.
Step 29: Without leaving the settings, go to the Packaging section and expand the top section of the Project . Uncheck Full Rebuild otherwise when you build the project, the whole engine will be recompiled, and this is a very, very long time! Full Rebuild should be used only when building release or other important builds, where a complete build is really necessary.
Step 30:The last step left is to configure the project for iOS. In the settings, go to the iOS section and click on the configuration button. Everything, your project is ready for packing and downloading to devices.
Step 31:In order to pack the project into a * .ipa file, close the settings and click in the main editor window File -> Package Project -> iOS. Select the directory where you want to place the finished ipa file and click OK. The compilation and packaging of the project will begin. At the end of the package, a folder with the name of the platform for which the assembly was performed (in our case it is iOS) will appear in the specified directory and in it you will find the coveted ipa file with the game. It is worth noting that the packaging can be quite long, and its progress can be monitored in the window Window -> Output Log. The process can take from several minutes to several hours if you have a weak machine under OS X. It all depends on your financial capabilities. But it’s worth noting that after the first compilation and regular change of only the project content in the editor itself,
Step 32: If everything goes smoothly and the assembly succeeds, you will get an ipa file that can be downloaded to your device, for example, using iTunes. Add ipa to iTunes (or put it in the folder for other applications on the disk, and he will see it himself). Connect the device to the computer, on the Apps tab, select your application from the list and click Install. It remains to synchronize your device and the application will be installed on the device.
Step 33: As an alternative method of launching applications on devices (you can run on several at the same time), in the editor, on the right side of the menu, click on the arrow next to the Launch button and select something like All_iOS_On_YourPC from the list , and then click on the Launch button. The project starts packing and installation on connected devices (Mac is also included in the work).
Conclusion
That's all. Your workplace is ready to create iOS projects on UE4 directly from your Windows PC. In conclusion, I note that this method works only with code-based projects. However, you can easily turn any Blueprint project into code-based by simply adding an empty code file to it: in the editor, click File -> Add Code To Project. Thus, the project will become code-based and will normally be built using the above method.
At the moment, the method has been tested on the following versions of the engine: 4.2.x, 4.3