@@ -27,7 +27,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2727
2828using UnityEditor ;
2929using UnityEditor . Callbacks ;
30-
30+ using UnityEditor . iOS . Xcode ;
3131
3232/// <summary>
3333/// Adding this post build script to Unity project enables the flutter-unity-widget to access it
@@ -50,6 +50,25 @@ public static void OnPostBuild(BuildTarget target, string pathToBuiltProject)
5050 }
5151
5252 PatchUnityNativeCode ( pathToBuiltProject ) ;
53+
54+ UpdateUnityProjectFiles ( pathToBuiltProject ) ;
55+ }
56+
57+ /// <summary>
58+ /// We need to add the Data folder to the UnityFramework framework
59+ /// </summary>
60+ private static void UpdateUnityProjectFiles ( string pathToBuiltProject )
61+ {
62+ var pbx = new PBXProject ( ) ;
63+ var pbxPath = Path . Combine ( pathToBuiltProject , "Unity-iPhone.xcodeproj/project.pbxproj" ) ;
64+ pbx . ReadFromFile ( pbxPath ) ;
65+
66+ // Add UnityExport/Data
67+ var targetGuid = pbx . TargetGuidByName ( "UnityFramework" ) ;
68+ var fileGuid = pbx . AddFolderReference ( Path . Combine ( pathToBuiltProject , "Data" ) , "Data" ) ;
69+ pbx . AddFileToBuild ( targetGuid , fileGuid ) ;
70+
71+ pbx . WriteToFile ( pbxPath ) ;
5372 }
5473
5574 /// <summary>
@@ -102,7 +121,6 @@ private static void EditUnityAppControllerH(string path)
102121 {
103122 var inScope = false ;
104123 var markerDetected = false ;
105- var markerAdded = false ;
106124
107125 // Add static GetAppController
108126 EditCodeFile ( path , line =>
0 commit comments