Select your preferred scripting language. All code snippets will be displayed in this language.
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Closeproj | The implicit this parameter for the extension method. |
mainTargetGuid | The GUID of the main target to link the app to. |
name | The name of the app extension. |
bundleId | The bundle ID of the app extension. The bundle ID must be prefixed with the parent app bundle ID. |
infoPlistPath | Path to the app extension Info.plist document. |
string The GUID of the new target.
Creates an app extension.
no example available in JavaScript
using UnityEditor; using UnityEngine; using UnityEditor.iOS.Xcode; using UnityEditor.iOS.Xcode.Extensions; using System.IO; using UnityEditor.Callbacks;
public class ScriptBatch : MonoBehaviour { [PostProcessBuild] private static void PostProcessBuild_iOS(BuildTarget target, string buildPath) { File.Copy("Assets/extension/TodayViewController.h", buildPath + "/appext/TodayViewController.h"); File.Copy("Assets/extension/TodayViewController.m", buildPath + "/appext/TodayViewController.m");
PBXProject proj = new PBXProject(); string projPath = PBXProject.GetPBXProjectPath(buildPath); proj.ReadFromFile(projPath);
string mainTarget = proj.TargetGuidByName(PBXProject.GetUnityTargetName());
string newTarget = proj.AddAppExtension(mainTarget, "appext", "com.unity3d.product.appext", "appext/Info.plist"); proj.AddFileToBuild(newTarget, proj.AddFile(buildPath + "/appext/TodayViewController.h", "appext/TodayViewController.h")); proj.AddFileToBuild(newTarget, proj.AddFile(buildPath + "/appext/TodayViewController.m", "appext/TodayViewController.m")); proj.AddFrameworkToProject(newTarget, "NotificationCenter.framework", true); proj.WriteToFile(projPath); } }
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information