first push!
This commit is contained in:
29
Assets/Shatalmic/Editor/BluetoothPostProcessBuild.cs
Normal file
29
Assets/Shatalmic/Editor/BluetoothPostProcessBuild.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
#if UNITY_IOS
|
||||
using UnityEditor.Callbacks;
|
||||
using UnityEditor;
|
||||
using UnityEditor.iOS.Xcode;
|
||||
using System.IO;
|
||||
|
||||
public class BluetoothPostProcessBuild
|
||||
{
|
||||
[PostProcessBuild]
|
||||
public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)
|
||||
{
|
||||
if (buildTarget == BuildTarget.iOS)
|
||||
{
|
||||
// Get plist
|
||||
string plistPath = pathToBuiltProject + "/Info.plist";
|
||||
PlistDocument plist = new PlistDocument();
|
||||
plist.ReadFromString(File.ReadAllText(plistPath));
|
||||
|
||||
// Get root
|
||||
PlistElementDict rootDict = plist.root;
|
||||
|
||||
rootDict.SetString("NSBluetoothAlwaysUsageDescription", "Uses BLE to communicate with devices.");
|
||||
|
||||
// Write to file
|
||||
File.WriteAllText(plistPath, plist.WriteToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user