Learn how to create games in Unity

This is useful when you want to edit the Info.plist of an Xcode project built by Unity when building for iOS. This can be used for example to change the values of Version (CFBundleShortVersionString) and Build (CFBundleVersion) in an Xcode project from within Unity, as a build post-process.

Step-by-step guide

  1. Create/Have a Unity project
  2. Create a folder inside Assets called Editor
  3. Download the Xcode Manipulation API files from https://bitbucket.org/Unity-Technologies/xcodeapi/src/ and place them inside a sub-folder inside Assets > Editor such as Assets > Editor > xcodeapi
  4. You can now create a script such as the one below to alter CFBundleVersion in Xcode plist

using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System.Collections;
using UnityEditor.iOS.Xcode;
using System.IO;

public class ChangeIOSBuildNumber {

public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject) {

    if (buildTarget == BuildTarget.iOS) {
        // Get plist
        string plistPath = pathToBuiltProject + "/Info.plist";
        PlistDocument plist = new PlistDocument();
        // Get root
        PlistElementDict rootDict = plist.root;
        // Change value of CFBundleVersion in Xcode plist
        var buildKey = "CFBundleVersion";
        // Write to file
        File.WriteAllText(plistPath, plist.WriteToString());


Which sets the CFBundleVersion in your Info.plist in a post process step to "2.3.4" (works also in Unity Cloud Build in all Tiers).

You’ve successfully subscribed to University of Games
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Your link has expired
Success! Check your email for magic link to sign-in.