Created
August 15, 2013 03:48
-
-
Save tsubaki/6238125 to your computer and use it in GitHub Desktop.
プラットフォーム切替時にbundleIdentifierを変更する
This file contains 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 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