Last active
September 12, 2018 04:04
-
-
Save arumani/deb11e450cded21c605ae73846eaa696 to your computer and use it in GitHub Desktop.
UnityでiOSプロジェクトを書き出した際に、iOS 10でカメラを使う場合に必須の記述をInfo.plistに追加するスクリプト。/Assets/Editor/ 以下に置く
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.Callbacks; | |
using System.IO; | |
using UnityEditor.iOS.Xcode; | |
public class AddCameraUsageToInfoPlist { | |
[PostProcessBuildAttribute(99)] | |
public static void OnPostprocessBuild(BuildTarget target, string buildPath) { | |
if (target != BuildTarget.iOS) { | |
return; | |
} | |
var plist = new PlistDocument (); | |
var filePath = Path.Combine (buildPath, "Info.plist"); | |
plist.ReadFromFile(filePath); | |
plist.root.SetString ("NSCameraUsageDescription", ""); | |
plist.WriteToFile (filePath); | |
Debug.Log ("Info.plist replaced."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment