Check how custom window looks like.As in my case there are two builds for each platform Simple and Christmas therefore I've added Christmas App toggle.
To create this custom window create a C# class "MyWindow" and inherit it from EditorWindow and paste the code given below.
bool iosBuild = true;
bool googleBuild;
bool amazonBuild;
bool christmasApp;
// Add menu item named "My Window" to the Window menu
[MenuItem("Window/Custom Player Settings")]
public static void ShowWindow()
{
//Show existing window instance. If one doesn't exist, make one.
EditorWindow.GetWindow(typeof(MyWindow));
}
void OnGUI()
{
iosBuild = EditorGUILayout.Toggle("iOS Build", iosBuild &&
!googleBuild && !amazonBuild);
googleBuild = EditorGUILayout.Toggle("Google Build", googleBuild &&
!iosBuild && !amazonBuild);
amazonBuild = EditorGUILayout.Toggle("Amazon Build", amazonBuild &&
!iosBuild && !googleBuild);
christmasApp = EditorGUILayout.ToggleLeft("Christmas App", christmasApp);
if (GUILayout.Button("Change Build Setting"))
{
if (iosBuild)
IOSSetting(christmasApp);
if (googleBuild)
GoogleSetting(christmasApp);
if (amazonBuild)
AmazonSetting(christmasApp);
}
}
Here ShowWindow function is creating window and OnGUI populating it.The MenuItem attribute turns any static function into a menu command and help in adding menu items to main menu and inspector.
There are three boolean variables one for each platform. iosBuild toggle is set on/true when other toggles are off/false and vice versa. When there is click event on "Change Build Setting" it calls corresponding setting function by checking boolean variables.
Add following functions in your class.
void IOSSetting(bool isChristmasVersion)
{
if (isChristmasVersion)
{
PlayerSettings.applicationIdentifier = "com.mycompany.myapp.christmas";
PlayerSettings.productName = "MyApp Christmas";
PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown,
new Texture2D[] { Resources.Load("icon2") as Texture2D });
}
else
{
PlayerSettings.applicationIdentifier = "com.mycompany.myapp";
PlayerSettings.productName = "MyApp";
PlayerSettings.SetIconsForTargetGroup(BuildTargetGroup.Unknown,
new Texture2D[] { Resources.Load("icon1") as Texture2D });
}
}
void GoogleSetting(bool isChristmasVersion)
{
// add your code
}
void AmazonSetting(bool isChristmasVersion)
{
// add your code
}