UnityEditor.XCodeEditor.XCProject.Save C# (CSharp) Method

Save() public method

Saves a project after editing.
public Save ( ) : void
return void
        public void Save()
        {
            PBXDictionary result = new PBXDictionary();
            result.Add( "archiveVersion", 1 );
            result.Add( "classes", new PBXDictionary() );
            result.Add( "objectVersion", 45 );

            Consolidate();
            result.Add( "objects", _objects );

            result.Add( "rootObject", _rootObjectKey );

            Backup();

            // Parse result object directly into file
            PBXParser parser = new PBXParser();
            StreamWriter saveFile = File.CreateText( System.IO.Path.Combine( this.filePath, "project.pbxproj" ) );
            saveFile.Write( parser.Encode( result, false ) );
            saveFile.Close();

            //			Xcode4Controller.Connect();
            //			Xcode4Controller.OpenProject(filePath);
        }

Usage Example

コード例 #1
0
        public static void OnPostProcessBuild(BuildTarget target, string path)
        {
            // If integrating with facebook on any platform, throw a warning if the app id is invalid
            if (!FBSettings.IsValidAppId)
            {
                Debug.LogWarning("You didn't specify a Facebook app ID.  Please add one using the Facebook menu in the main Unity editor.");
            }

            bool needsNewClassnames = IsVersion42OrLater ();

            if (target == BuildTarget.iPhone)
            {
                UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject (path);

                // Find and run through all projmods files to patch the project

                string projModPath = System.IO.Path.Combine (Application.dataPath, "Facebook/Editor/iOS");
                var files = System.IO.Directory.GetFiles (projModPath, "*.projmods", System.IO.SearchOption.AllDirectories);
                foreach (var file in files)
                {
                    project.ApplyMod (Application.dataPath, file);
                }
                project.Save ();

                PlistMod.UpdatePlist (path, FBSettings.AppId);
                FixupFiles.FixSimulator (path);

                if(needsNewClassnames)
                    FixupFiles.AddVersionDefine (path);
            }
        }
All Usage Examples Of UnityEditor.XCodeEditor.XCProject::Save