private static void BootstrapPlatformSettingsPrefabs()
        {
            PlatformSettingsMultiplexer mux;

            mux = PlatformSettingsMultiplexer.Instance;

            foreach (Platform platform in PlatformUtil.AllPlatforms)
            {
                PlatformSettingsPrefab oldPrefab;
                oldPrefab = mux.GetPrefab(platform);

                PlatformSettingsPrefab newPrefab;
                newPrefab = oldPrefab;

                if (newPrefab == null)
                {
                    newPrefab = PlatformSettingsPrefabEditor.GetPrefabs(platform).FirstOrDefault();
                }

                if (newPrefab == null)
                {
                    newPrefab = PlatformSettingsPrefabEditor.GetDefaultPrefab(platform);
                }

                if (newPrefab != oldPrefab)
                {
                    mux.SetPrefab(platform, newPrefab);
                    EditorUtility.SetDirty(mux);
                }
            }
        }
示例#2
0
 public static void OnPlatformBootstrap()
 {
     PlatformSettingsPrefabEditor.AddPrefabComponents <tvOSProductInfo>(PlatformUtilEditor.tvOSPlatforms);
 }
示例#3
0
        public static void OnPlatformBootstrap()
        {
            // Getting the list of all android platforms except Google Play and Google Play Free
            Platform[] androidPlatformsExceptGooglePlay = PlatformUtilEditor.AndroidPlatforms
                                                          .Where(p => p != Platform.GooglePlay && p != Platform.GooglePlayFree).ToArray();

            // Adding AndroidProductInfo component to all platforms except Google Play and Google Play Free
            PlatformSettingsPrefabEditor.AddPrefabComponents <AndroidProductInfo>(androidPlatformsExceptGooglePlay);

            // Adding GooglePlayProductInfo to Google Play / Google Play Free platforms and remove the AndroidProductInfo
            PlatformSettingsPrefabEditor.AddPrefabComponents <GooglePlayProductInfo>(Platform.GooglePlay);
            PlatformSettingsPrefabEditor.AddPrefabComponents <GooglePlayProductInfo>(Platform.GooglePlayFree);

            // GooglePlay
            PlatformSettingsPrefab[] prefabs = PlatformSettingsPrefabEditor.GetPrefabs(Platform.GooglePlay);

            foreach (PlatformSettingsPrefab googlePlayPrefab in prefabs)
            {
                AndroidProductInfo[] androidInfoComponents = googlePlayPrefab.GetComponents <AndroidProductInfo>();

                var obsoleteComponents = androidInfoComponents.Where(info => info.GetType() != typeof(GooglePlayProductInfo));
                if (obsoleteComponents.Count() != 0)
                {
                    AndroidProductInfo newComponent      = androidInfoComponents.Where(info => info.GetType() == typeof(GooglePlayProductInfo)).Single();
                    AndroidProductInfo obsoleteComponent = obsoleteComponents.First();
                    newComponent.name       = obsoleteComponent.name;
                    newComponent.Identifier = obsoleteComponent.Identifier;
                    newComponent.Version    = obsoleteComponent.Version;
                    newComponent.Build      = obsoleteComponent.Build;
                    newComponent.SdkVersion = obsoleteComponent.SdkVersion;

                    foreach (AndroidProductInfo obs in obsoleteComponents)
                    {
                        DestroyImmediate(obs, true);
                    }
                }
            }

            // GooglePlayFree
            PlatformSettingsPrefab[] prefabsGooglePlayFree = PlatformSettingsPrefabEditor.GetPrefabs(Platform.GooglePlay);

            foreach (PlatformSettingsPrefab googlePlayFreePrefab in prefabsGooglePlayFree)
            {
                AndroidProductInfo[] androidInfoComponents = googlePlayFreePrefab.GetComponents <AndroidProductInfo>();

                var obsoleteComponents = androidInfoComponents.Where(info => info.GetType() != typeof(GooglePlayProductInfo));
                if (obsoleteComponents.Count() != 0)
                {
                    AndroidProductInfo newComponent      = androidInfoComponents.Where(info => info.GetType() == typeof(GooglePlayProductInfo)).Single();
                    AndroidProductInfo obsoleteComponent = obsoleteComponents.First();
                    newComponent.name       = obsoleteComponent.name;
                    newComponent.Identifier = obsoleteComponent.Identifier;
                    newComponent.Version    = obsoleteComponent.Version;
                    newComponent.Build      = obsoleteComponent.Build;
                    newComponent.SdkVersion = obsoleteComponent.SdkVersion;

                    foreach (AndroidProductInfo obs in obsoleteComponents)
                    {
                        DestroyImmediate(obs, true);
                    }
                }
            }
        }