Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created August 15, 2013 03:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/6238125 to your computer and use it in GitHub Desktop.
Save tsubaki/6238125 to your computer and use it in GitHub Desktop.
プラットフォーム切替時にbundleIdentifierを変更する
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
public class BundleIdentifierChange
{
static string androidBundleIdentifier = "android";
static string iOSBundleIdentifier = "iOS";
static string otherBundleIdentifier = "other";
static BundleIdentifierChange ()
{
EditorUserBuildSettings.activeBuildTargetChanged += OnChangedPlatform;
}
static void OnChangedPlatform ()
{
switch (EditorUserBuildSettings.activeBuildTarget) {
case BuildTarget.iPhone:
PlayerSettings.bundleIdentifier = iOSBundleIdentifier;
break;
case BuildTarget.Android:
PlayerSettings.bundleIdentifier = androidBundleIdentifier;
break;
default:
PlayerSettings.bundleIdentifier = otherBundleIdentifier;
break;
}
Debug.Log ("current bundleIdentifier : " + PlayerSettings.bundleIdentifier);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment