Accessing game files in XCode project?

I have a quick question about the XCode project which Unity generates for IOS builds. How can I access some of my Game files in the XCode project?

For example, in my Unity project Asset folder, I have a folder call “Resources” where I store some files to be loaded at run-time. One of those file is a “.txt” file which contains base settings for some upgrades. I would like to be able to change the contents of that “.txt” file from within XCode, so that I don’t have to go back to Unity and need to re-build the project, since it’s the only way to make sure the changes get included in the XCode project.

The other thing which bugs me when changing 1 tiny little thing in Unity is that you have to re-build the whole project every time…isn’t there a way to only update the file you changed by copying it to XCode instead of re-building every time?

Thanks in advance for your time!

Hey Steph,

There are two ways…

If it is a code file like .a, .m. .mm. .c, .cpp it will copy over from Assets/Plugins/iOS to the project…:

Automated plugin integration

Unity iOS supports limited automated
plugin integration.

All the .a,.m,.mm,.c,.cpp located in
Assets/Plugins/iOS will be
automatically merged into produced
Xcode project. Merging is done by
symlinking files from
Assets/Plugins/iOS to the final
destination and this might affect some
workflows. .h files are not included
into Xcode project tree, but they
appear on final destination file
system, thus allowing compilation of
.m/.mm/.c/.cpp. Note: subfolders are
not supported.

Since your’s is a text or a json/xml file then you need to make a folder called ‘StreamingAssets’ that will auto copy over to the project. This will copy to a folder called ‘Data/Raw’ in your iOS project folder (although it will not be visible in xcode project but will be in Finder). When you load from ‘StreamingAssets’ you need to use a pathing system like:

Use these methods to get the file in game…

using System;
using System.IO;
using UnityEngine;

public class Pathing
	public static string AppDataPath
		get {				
			return Application.dataPath; // gets app install path...

	// gets streaming assets raw path... 
	public static Uri AppContentDataUri
		get {
			if(Application.platform == RuntimePlatform.IPhonePlayer) {
				var uriBuilder = new UriBuilder();		
				uriBuilder.Scheme = "file";
				uriBuilder.Path = Path.Combine(AppDataPath, "Raw");
				return uriBuilder.Uri;
			else if(Application.platform == RuntimePlatform.Android) {
				return new Uri("jar:file://" + Application.dataPath + "!/assets");
			else {
				var uriBuilder = new UriBuilder();
				uriBuilder.Scheme = "file";
				uriBuilder.Path = Path.Combine(AppDataPath, "StreamingAssets");
				return uriBuilder.Uri;


If you added your file to the ‘StreamingAssets’ folder in Unity (won’t show in the xcode project but will be there in file system). You can access it by using the above method/property:

string mySettingsFile = Paths.AppContentDataUri + "/myfile.json.txt";

Keep in mind you will still have to change in unity, export initially, but here you can iterate at least to get it right in xcode. Then be sure to update in Unity else it will re-copy over.

Note: You can also just add it to ‘Resources/Data’ on xcode project and expect it to be there on device and access it with the path above. It may take some debugging/logging to be sure you have correct path but that will also work so you can just change in xcode or finder.

Add these methods to get documents folder if putting there.

public static string GetAppSandboxPathIPhone() {
	// We need to strip "/"
	return Path.GetDirectoryName(Path.GetDirectoryName(Application.dataPath));

public static string GetAppPersistencePathIPhone() {
	return Path.Combine(GetAppSandboxPathIPhone(), "Documents");

you can u also TextAsset.
public TextAsset xyz;

Assign Your text file in xyz.
and you can use simply…