private void OverwriteImportSettings(AudioImporter target, AudioImporter reference) { target.defaultSampleSettings = reference.defaultSampleSettings; target.forceToMono = reference.forceToMono; target.preloadAudioData = reference.preloadAudioData; foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.AudioImporter); if (reference.ContainsSampleSettingsOverride(platformName)) { var setting = reference.GetOverrideSampleSettings(platformName); if (!target.SetOverrideSampleSettings(platformName, setting)) { LogUtility.Logger.LogError("AudioImporter", string.Format("Failed to set override setting for {0}: {1}", platformName, target.assetPath)); } } else { target.ClearSampleSettingOverride(platformName); } } target.loadInBackground = reference.loadInBackground; target.ambisonic = reference.ambisonic; }
private void CellGUI(Rect cellRect, TreeViewItem item, int column, ref RowGUIArgs args) { ExecuteResultTreeItem resultItem = item as ExecuteResultTreeItem; NodeExceptionItem exceptionItem = item as NodeExceptionItem; ExecuteGraphResult r = null; NodeException e = null; if (resultItem != null) { r = resultItem.Result; } else { r = exceptionItem.Result; e = exceptionItem.Exception; } switch (column) { case 0://Collapse/Expand { DefaultGUI.Label(cellRect, string.Empty, args.selected, args.focused); } break; case 1://Status { var rect = cellRect; if (e != null) { rect.x += 8f; } DefaultGUI.Label(rect, (r.IsAnyIssueFound) ? "Fail" : "Success", args.selected, args.focused); } break; case 2://Graph { var graphName = Path.GetFileNameWithoutExtension(r.GraphAssetPath); DefaultGUI.Label(cellRect, graphName, args.selected, args.focused); } break; case 3://Platform DefaultGUI.Label(cellRect, BuildTargetUtility.TargetToHumaneString(r.Target), args.selected, args.focused); break; case 4://Description if (e != null) { DefaultGUI.Label(cellRect, e.Reason, args.selected, args.focused); } else { DefaultGUI.Label(cellRect, string.Empty, args.selected, args.focused); } break; } }
public string this[BuildTarget index] { get { return(this[BuildTargetUtility.TargetToGroup(index)]); } set { this[BuildTargetUtility.TargetToGroup(index)] = value; } }
private void OverwriteImportSettings(TextureImporter target, TextureImporter reference, string tagName) { target.textureType = reference.textureType; var targetSetting = new TextureImporterSettings(); var referenceSetting = new TextureImporterSettings(); target.ReadTextureSettings(targetSetting); reference.ReadTextureSettings(referenceSetting); //以下都是被锁定的图片设置 targetSetting.aniso = referenceSetting.aniso; targetSetting.compressionQuality = referenceSetting.compressionQuality; targetSetting.spriteGenerateFallbackPhysicsShape = referenceSetting.spriteGenerateFallbackPhysicsShape; targetSetting.spritePixelsPerUnit = referenceSetting.spritePixelsPerUnit; targetSetting.npotScale = referenceSetting.npotScale; targetSetting.readable = referenceSetting.readable; targetSetting.streamingMipmapsPriority = referenceSetting.streamingMipmapsPriority; targetSetting.mipmapEnabled = referenceSetting.mipmapEnabled; target.SetTextureSettings(targetSetting); target.androidETC2FallbackOverride = reference.androidETC2FallbackOverride; target.anisoLevel = reference.anisoLevel; target.compressionQuality = reference.compressionQuality; target.crunchedCompression = reference.crunchedCompression; target.isReadable = reference.isReadable; target.npotScale = reference.npotScale; target.streamingMipmapsPriority = reference.streamingMipmapsPriority; target.streamingMipmaps = reference.streamingMipmaps; target.textureCompression = reference.textureCompression; target.mipmapEnabled = reference.mipmapEnabled; if (m_overwritePackingTag) { if (!string.IsNullOrEmpty(tagName)) { target.spritePackingTag = tagName; } else { target.spritePackingTag = reference.spritePackingTag; } } var defaultPlatformSetting = reference.GetDefaultPlatformTextureSettings(); target.SetPlatformTextureSettings(defaultPlatformSetting); foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.TextureImporter); var impSet = reference.GetPlatformTextureSettings(platformName); target.SetPlatformTextureSettings(impSet); } }
public override void Build(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output, Action <Model.NodeData, string, float> progressFunc) { if (incoming == null) { return; } if (!Directory.Exists(m_buildLocations[target])) { Directory.CreateDirectory(m_buildLocations[target]); } var sceneGUIDs = m_scenes[target].Split(','); #if UNITY_5_5_OR_NEWER string manifestPath = string.Empty; foreach (var ag in incoming) { foreach (var assets in ag.assetGroups.Values) { var manifestBundle = assets.Where(a => a.assetType == typeof(AssetBundleManifestReference)); if (manifestBundle.Any()) { manifestPath = manifestBundle.First().importFrom; } } } BuildPlayerOptions opt; opt.options = (BuildOptions)m_buildOptions[target]; opt.locationPathName = m_buildLocations[target] + "/" + m_playerName[target]; opt.assetBundleManifestPath = manifestPath; opt.scenes = sceneGUIDs.Select(guid => AssetDatabase.GUIDToAssetPath(guid)).Where(path => !string.IsNullOrEmpty(path) && !path.Contains("__DELETED_GUID_Trash")).ToArray(); opt.target = target; #if UNITY_5_6_OR_NEWER opt.targetGroup = BuildTargetUtility.TargetToGroup(target); #endif var errorMsg = BuildPipeline.BuildPlayer(opt); #else string[] levels = sceneGUIDs.Select(guid => AssetDatabase.GUIDToAssetPath(guid)).Where(path => !string.IsNullOrEmpty(path) && !path.Contains("__DELETED_GUID_Trash")).ToArray(); string locationPathName = m_buildLocations[target] + "/" + m_playerName[target]; BuildOptions opt = (BuildOptions)m_buildOptions[target]; var errorMsg = BuildPipeline.BuildPlayer(levels, locationPathName, target, opt); #endif if (!string.IsNullOrEmpty(errorMsg)) { throw new NodeException(node.Name + ":Player build failed:" + errorMsg, node); } }
private bool IsEqual(AudioImporter target, AudioImporter reference) { UnityEngine.Assertions.Assert.IsNotNull(reference); if (!IsEqualAudioSampleSetting(target.defaultSampleSettings, reference.defaultSampleSettings)) { return(false); } foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.AudioImporter); if (target.ContainsSampleSettingsOverride(platformName) != reference.ContainsSampleSettingsOverride(platformName)) { return(false); } if (target.ContainsSampleSettingsOverride(platformName)) { var t = target.GetOverrideSampleSettings(platformName); var r = reference.GetOverrideSampleSettings(platformName); if (!IsEqualAudioSampleSetting(t, r)) { return(false); } } } if (target.forceToMono != reference.forceToMono) { return(false); } if (target.loadInBackground != reference.loadInBackground) { return(false); } #if UNITY_2017_1_OR_NEWER if (target.ambisonic != reference.ambisonic) { return(false); } #endif if (target.preloadAudioData != reference.preloadAudioData) { return(false); } return(true); }
private string PrepareOutputDirectory(BuildTarget target, Model.NodeData node, bool autoCreate, bool throwException) { var outputOption = (OutputOption)m_outputOption [target]; if (outputOption == OutputOption.BuildInCacheDirectory) { return(FileUtility.EnsureAssetBundleCacheDirExists(target, node)); } var outputDir = m_outputDir [target]; outputDir = outputDir.Replace("{Platform}", BuildTargetUtility.TargetToAssetBundlePlatformName(target)); if (throwException) { if (string.IsNullOrEmpty(outputDir)) { throw new NodeException("Output directory is empty.", "Select valid output directory from inspector.", node); } if (target != BuildTargetUtility.GroupToTarget(BuildTargetGroup.Unknown) && outputOption == OutputOption.ErrorIfNoOutputDirectoryFound) { if (!Directory.Exists(outputDir)) { throw new NodeException("Output directory not found. \n" + outputDir, "Create output directory or select other valid directory from inspector.", node); } } } if (autoCreate) { if (outputOption == OutputOption.DeleteAndRecreateOutputDirectory) { if (Directory.Exists(outputDir)) { FileUtility.DeleteDirectory(outputDir, true); } } if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } } return(outputDir); }
private static void OverwriteImportSettings(VideoClipImporter target, VideoClipImporter reference) { target.defaultTargetSettings = reference.defaultTargetSettings; target.deinterlaceMode = reference.deinterlaceMode; target.flipHorizontal = reference.flipHorizontal; target.flipVertical = reference.flipVertical; target.importAudio = reference.importAudio; target.keepAlpha = reference.keepAlpha; #if !UNITY_2019_3_OR_NEWER target.linearColor = reference.linearColor; target.quality = reference.quality; target.useLegacyImporter = reference.useLegacyImporter; #endif foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.VideoClipImporter); try { var setting = reference.GetTargetSettings(platformName); if (setting != null) { target.SetTargetSettings(platformName, setting); } else { target.ClearTargetSettings(platformName); } } catch (Exception e) { LogUtility.Logger.LogWarning("VideoClipImporter", $"Failed to set override setting for platform {platformName}: file :{target.assetPath} \\nreason:{e.Message}"); } } /* read only */ /* * importer.frameCount * importer.frameRate * importer.isPlayingPreview * importer.outputFileSize * importer.sourceAudioTrackCount * importer.sourceFileSize * importer.sourceHasAlpha * importer.pixelAspectRatioDenominator * importer.pixelAspectRatioNumerator */ }
private string GetPackageNameForGroup(BuildTarget target, string groupKey) { var exportPackageName = m_packageName[target]; var packageName = string.IsNullOrEmpty(exportPackageName) ? groupKey : exportPackageName. Replace("{GroupName}", groupKey). Replace("{Platform}", BuildTargetUtility.TargetToAssetBundlePlatformName(target)); if (!packageName.EndsWith(".unitypackage")) { packageName += ".unitypackage"; } return(packageName); }
private void DrawSelectedExecuteResultMessage(Rect region) { string msg = null; // no item selected if (m_selectedResult == null) { msg = string.Empty; } // build result else if (m_selectedException == null) { var graphName = Path.GetFileNameWithoutExtension(m_selectedResult.GraphAssetPath); msg = string.Format("Build {2}.\n\nGraph:{0}\nPlatform:{1}", graphName, BuildTargetUtility.TargetToHumaneString(m_selectedResult.Target), m_selectedResult.IsAnyIssueFound ? "Failed" : "Successful" ); } // build result with exception else { var graphName = Path.GetFileNameWithoutExtension(m_selectedResult.GraphAssetPath); msg = string.Format("{0}\n\nHow to fix:\n{1}\n\nWhere:'{2}' in {3}\nPlatform:{4}", m_selectedException.Reason, m_selectedException.HowToFix, m_selectedException.Node.Name, graphName, BuildTargetUtility.TargetToHumaneString(m_selectedResult.Target)); } var msgStyle = GUI.skin.label; msgStyle.alignment = TextAnchor.UpperLeft; msgStyle.wordWrap = true; var content = new GUIContent(msg); var height = msgStyle.CalcHeight(content, region.width - 16f); var msgRect = new Rect(0f, 0f, region.width - 16f, height); m_msgScrollPos = GUI.BeginScrollView(region, m_msgScrollPos, msgRect); GUI.Label(msgRect, content); GUI.EndScrollView(); }
public static bool IsBuildTargetSupported(BuildTarget t) { var objType = typeof(UnityEditor.BuildPipeline); var method = objType.GetMethod("IsBuildTargetSupported", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); #if UNITY_5_6 || UNITY_5_6_OR_NEWER BuildTargetGroup g = BuildTargetUtility.TargetToGroup(t); //internal static extern bool IsBuildTargetSupported (BuildTargetGroup buildTargetGroup, BuildTarget target); var retval = method.Invoke(null, new object[] { System.Enum.ToObject(typeof(BuildTargetGroup), g), System.Enum.ToObject(typeof(BuildTarget), t) }); #else //internal static extern bool IsBuildTargetSupported (BuildTarget target); var retval = method.Invoke(null, new object[] { System.Enum.ToObject(typeof(BuildTarget), t) }); #endif return(Convert.ToBoolean(retval)); }
protected override void ContextClicked() { if (m_ctxMenuClickOnItem) { m_ctxMenuClickOnItem = false; return; } GenericMenu menu = new GenericMenu(); var currentTargets = BatchBuildConfig.GetConfig().BuildTargets; foreach (var t in NodeGUIUtility.SupportedBuildTargets) { if (!currentTargets.Contains(t)) { menu.AddItem(new GUIContent($"Add {BuildTargetUtility.TargetToHumaneString(t)}"), false, () => { MenuAction_AddTarget(t); }); } } menu.ShowAsContext(); }
public void SetupSupportedBuildTargets() { if (supportedBuildTargets == null) { supportedBuildTargets = new List <BuildTarget>(); supportedBuildTargetGroups = new List <BuildTargetGroup>(); try { foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget))) { if (BuildTargetUtility.IsBuildTargetSupported(target)) { if (!supportedBuildTargets.Contains(target)) { supportedBuildTargets.Add(target); } BuildTargetGroup g = BuildTargetUtility.TargetToGroup(target); if (g == BuildTargetGroup.Unknown) { // skip unknown platform continue; } if (!supportedBuildTargetGroups.Contains(g)) { supportedBuildTargetGroups.Add(g); } } } supportedBuildTargetNames = new string[supportedBuildTargets.Count]; for (int i = 0; i < supportedBuildTargets.Count; ++i) { supportedBuildTargetNames[i] = BuildTargetUtility.TargetToHumaneString(supportedBuildTargets[i]); } } catch (Exception e) { LogUtility.Logger.LogError(LogUtility.kTag, e); } } }
public override void Build(BuildTarget target, Model.NodeData node, IEnumerable <PerformGraph.AssetGroups> incoming, IEnumerable <Model.ConnectionData> connectionsToOutput, PerformGraph.Output Output, Action <Model.NodeData, string, float> progressFunc) { if (incoming == null) { return; } if (!Directory.Exists(m_buildLocations[target])) { Directory.CreateDirectory(m_buildLocations[target]); } var sceneGUIDs = m_scenes[target].Split(','); string manifestPath = string.Empty; foreach (var ag in incoming) { foreach (var assets in ag.assetGroups.Values) { var manifestBundle = assets.Where(a => a.assetType == typeof(AssetBundleManifestReference)); if (manifestBundle.Any()) { manifestPath = manifestBundle.First().importFrom; } } } BuildPlayerOptions opt = new BuildPlayerOptions { options = (BuildOptions)m_buildOptions[target], locationPathName = m_buildLocations[target] + "/" + m_playerName[target], assetBundleManifestPath = manifestPath, scenes = sceneGUIDs.Select(AssetDatabase.GUIDToAssetPath).Where(path => !string.IsNullOrEmpty(path) && !path.Contains("__DELETED_GUID_Trash")).ToArray(), target = target, targetGroup = BuildTargetUtility.TargetToGroup(target) }; var report = BuildPipeline.BuildPlayer(opt); var summary = report.summary; switch (summary.result) { case BuildResult.Failed: throw new NodeException( $"Player build failed. ({summary.totalErrors} errors)", summary.ToString(), node); case BuildResult.Cancelled: LogUtility.Logger.Log(LogUtility.kTag, "Player build cancelled."); break; case BuildResult.Unknown: throw new NodeException( "Player build ended with Unknown state.", summary.ToString(), node); } }
private void OverwriteImportSettings(TextureImporter target, TextureImporter reference, string tagName) { target.textureType = reference.textureType; var dstSettings = new TextureImporterSettings(); var srcSettings = new TextureImporterSettings(); target.ReadTextureSettings(srcSettings); reference.ReadTextureSettings(dstSettings); if (!m_overwriteSpriteSheet) { dstSettings.spriteAlignment = srcSettings.spriteAlignment; dstSettings.spriteBorder = srcSettings.spriteBorder; dstSettings.spriteExtrude = srcSettings.spriteExtrude; dstSettings.spriteMode = srcSettings.spriteMode; dstSettings.spriteMeshType = srcSettings.spriteMeshType; dstSettings.spritePivot = srcSettings.spritePivot; dstSettings.spritePixelsPerUnit = srcSettings.spritePixelsPerUnit; dstSettings.spriteTessellationDetail = srcSettings.spriteTessellationDetail; } target.SetTextureSettings(dstSettings); if (m_overwriteSpriteSheet) { target.spritesheet = reference.spritesheet; } // some unity version do not properly copy properties via TextureSettings, // so also perform manual copy target.allowAlphaSplitting = reference.allowAlphaSplitting; target.alphaIsTransparency = reference.alphaIsTransparency; target.alphaSource = reference.alphaSource; target.alphaTestReferenceValue = reference.alphaTestReferenceValue; target.androidETC2FallbackOverride = reference.androidETC2FallbackOverride; target.anisoLevel = reference.anisoLevel; target.borderMipmap = reference.borderMipmap; target.compressionQuality = reference.compressionQuality; target.convertToNormalmap = reference.convertToNormalmap; target.crunchedCompression = reference.crunchedCompression; target.fadeout = reference.fadeout; target.filterMode = reference.filterMode; target.generateCubemap = reference.generateCubemap; target.heightmapScale = reference.heightmapScale; target.isReadable = reference.isReadable; target.maxTextureSize = reference.maxTextureSize; target.mipMapBias = reference.mipMapBias; target.mipmapEnabled = reference.mipmapEnabled; target.mipmapFadeDistanceEnd = reference.mipmapFadeDistanceEnd; target.mipmapFadeDistanceStart = reference.mipmapFadeDistanceStart; target.mipmapFilter = reference.mipmapFilter; target.mipMapsPreserveCoverage = reference.mipMapsPreserveCoverage; target.normalmapFilter = reference.normalmapFilter; target.npotScale = reference.npotScale; target.sRGBTexture = reference.sRGBTexture; target.streamingMipmaps = reference.streamingMipmaps; target.streamingMipmapsPriority = reference.streamingMipmapsPriority; target.textureCompression = reference.textureCompression; target.textureShape = reference.textureShape; target.wrapMode = reference.wrapMode; target.wrapModeU = reference.wrapModeU; target.wrapModeV = reference.wrapModeV; target.wrapModeW = reference.wrapModeW; if (m_overwritePackingTag) { if (!string.IsNullOrEmpty(tagName)) { target.spritePackingTag = tagName; } else { target.spritePackingTag = reference.spritePackingTag; } } var defaultPlatformSetting = reference.GetDefaultPlatformTextureSettings(); target.SetPlatformTextureSettings(defaultPlatformSetting); foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.TextureImporter); var impSet = reference.GetPlatformTextureSettings(platformName); target.SetPlatformTextureSettings(impSet); } }
private bool IsEqual(TextureImporter target, TextureImporter reference, string tagName) { // UnityEditor.TextureImporter.textureFormat' is obsolete: // `textureFormat is not longer accessible at the TextureImporter level if (target.textureType != reference.textureType) { return(false); } TextureImporterSettings targetSetting = new TextureImporterSettings(); TextureImporterSettings referenceSetting = new TextureImporterSettings(); target.ReadTextureSettings(targetSetting); reference.ReadTextureSettings(referenceSetting); // if m_overwriteSpriteSheet is false, following properties // should be ignored if (!m_overwriteSpriteSheet) { referenceSetting.spriteAlignment = targetSetting.spriteAlignment; referenceSetting.spriteBorder = targetSetting.spriteBorder; referenceSetting.spriteExtrude = targetSetting.spriteExtrude; referenceSetting.spriteMode = targetSetting.spriteMode; referenceSetting.spriteMeshType = targetSetting.spriteMeshType; referenceSetting.spritePivot = targetSetting.spritePivot; referenceSetting.spritePixelsPerUnit = targetSetting.spritePixelsPerUnit; referenceSetting.spriteTessellationDetail = targetSetting.spriteTessellationDetail; } if (!TextureImporterSettings.Equal(targetSetting, referenceSetting)) { return(false); } if (target.textureType == TextureImporterType.Sprite) { if (m_overwritePackingTag) { if (!string.IsNullOrEmpty(tagName)) { if (target.spritePackingTag != tagName) { return(false); } } else { if (target.spritePackingTag != reference.spritePackingTag) { return(false); } } } if (m_overwriteSpriteSheet) { if (target.spriteBorder != reference.spriteBorder) { return(false); } if (target.spriteImportMode != reference.spriteImportMode) { return(false); } if (target.spritePivot != reference.spritePivot) { return(false); } if (target.spritePixelsPerUnit != reference.spritePixelsPerUnit) { return(false); } var s1 = target.spritesheet; var s2 = reference.spritesheet; if (s1.Length != s2.Length) { return(false); } for (int i = 0; i < s1.Length; ++i) { if (s1 [i].alignment != s2 [i].alignment) { return(false); } if (s1 [i].border != s2 [i].border) { return(false); } if (s1 [i].name != s2 [i].name) { return(false); } if (s1 [i].pivot != s2 [i].pivot) { return(false); } if (s1 [i].rect != s2 [i].rect) { return(false); } } } } if (target.allowAlphaSplitting != reference.allowAlphaSplitting) { return(false); } if (target.alphaIsTransparency != reference.alphaIsTransparency) { return(false); } if (target.alphaSource != reference.alphaSource) { return(false); } if (target.alphaTestReferenceValue != reference.alphaTestReferenceValue) { return(false); } if (target.androidETC2FallbackOverride != reference.androidETC2FallbackOverride) { return(false); } if (target.anisoLevel != reference.anisoLevel) { return(false); } if (target.borderMipmap != reference.borderMipmap) { return(false); } if (target.compressionQuality != reference.compressionQuality) { return(false); } if (target.convertToNormalmap != reference.convertToNormalmap) { return(false); } if (target.crunchedCompression != reference.crunchedCompression) { return(false); } if (target.fadeout != reference.fadeout) { return(false); } if (target.filterMode != reference.filterMode) { return(false); } if (target.generateCubemap != reference.generateCubemap) { return(false); } if (target.heightmapScale != reference.heightmapScale) { return(false); } if (target.isReadable != reference.isReadable) { return(false); } if (target.maxTextureSize != reference.maxTextureSize) { return(false); } if (target.mipMapBias != reference.mipMapBias) { return(false); } if (target.mipmapEnabled != reference.mipmapEnabled) { return(false); } if (target.mipmapFadeDistanceEnd != reference.mipmapFadeDistanceEnd) { return(false); } if (target.mipmapFadeDistanceStart != reference.mipmapFadeDistanceStart) { return(false); } if (target.mipmapFilter != reference.mipmapFilter) { return(false); } if (target.mipMapsPreserveCoverage != reference.mipMapsPreserveCoverage) { return(false); } if (target.normalmapFilter != reference.normalmapFilter) { return(false); } if (target.npotScale != reference.npotScale) { return(false); } if (target.sRGBTexture != reference.sRGBTexture) { return(false); } if (target.streamingMipmaps != reference.streamingMipmaps) { return(false); } if (target.streamingMipmapsPriority != reference.streamingMipmapsPriority) { return(false); } if (target.textureCompression != reference.textureCompression) { return(false); } if (target.textureShape != reference.textureShape) { return(false); } if (target.wrapMode != reference.wrapMode) { return(false); } if (target.wrapModeU != reference.wrapModeU) { return(false); } if (target.wrapModeV != reference.wrapModeV) { return(false); } if (target.wrapModeW != reference.wrapModeW) { return(false); } var refDefault = reference.GetDefaultPlatformTextureSettings(); var impDefault = target.GetDefaultPlatformTextureSettings(); if (!CompareImporterPlatformSettings(refDefault, impDefault)) { return(false); } foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.TextureImporter); var impSet = reference.GetPlatformTextureSettings(platformName); var targetImpSet = target.GetPlatformTextureSettings(platformName); if (!CompareImporterPlatformSettings(impSet, targetImpSet)) { return(false); } } return(true); }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { EditorGUILayout.HelpBox("Generate Asset: Generate new asset from incoming asset.", MessageType.Info); editor.UpdateNodeName(node); GUILayout.Space(8f); if (m_popupIcon == null) { m_popupIcon = EditorGUIUtility.Load(EditorGUIUtility.isProSkin ? "icons/d__Popup.png" : "icons/_Popup.png") as Texture2D; } editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope()) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_outputOption.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { if (enabled) { m_outputOption[editor.CurrentEditingGroup] = m_outputOption.DefaultValue; m_outputDir[editor.CurrentEditingGroup] = m_outputDir.DefaultValue; } else { m_outputOption.Remove(editor.CurrentEditingGroup); m_outputDir.Remove(editor.CurrentEditingGroup); } onValueChanged(); }); using (disabledScope) { OutputOption opt = (OutputOption)m_outputOption[editor.CurrentEditingGroup]; var newOption = (OutputOption)EditorGUILayout.EnumPopup("Output Option", opt); if (newOption != opt) { using (new RecordUndoScope("Change Output Option", node, true)){ m_outputOption[editor.CurrentEditingGroup] = (int)newOption; onValueChanged(); } opt = newOption; } if (opt != OutputOption.CreateInCacheDirectory) { EditorGUILayout.HelpBox("When you are not creating assets under cache directory, make sure your generators are not overwriting assets each other.", MessageType.Info); } using (new EditorGUI.DisabledScope(opt == OutputOption.CreateInCacheDirectory)) { var newDirPath = m_outputDir[editor.CurrentEditingGroup]; if (opt == OutputOption.CreateInSelectedDirectory) { newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder", m_outputDir [editor.CurrentEditingGroup], Application.dataPath, (string folderSelected) => { string basePath = Application.dataPath; if (basePath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(basePath); if (index >= 0) { folderSelected = folderSelected.Substring(basePath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); } else if (opt == OutputOption.RelativeToSourceAsset) { newDirPath = EditorGUILayout.TextField("Relative Path", m_outputDir[editor.CurrentEditingGroup]); } if (newDirPath != m_outputDir[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Output Directory", node, true)){ m_outputDir[editor.CurrentEditingGroup] = newDirPath; onValueChanged(); } } var dirPath = Path.Combine(Application.dataPath, m_outputDir [editor.CurrentEditingGroup]); if (opt == OutputOption.CreateInSelectedDirectory && !string.IsNullOrEmpty(m_outputDir [editor.CurrentEditingGroup]) && !Directory.Exists(dirPath)) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(m_outputDir[editor.CurrentEditingGroup] + " does not exist."); if (GUILayout.Button("Create directory")) { Directory.CreateDirectory(dirPath); AssetDatabase.Refresh(); } } EditorGUILayout.Space(); string parentDir = Path.GetDirectoryName(m_outputDir[editor.CurrentEditingGroup]); if (Directory.Exists(parentDir)) { EditorGUILayout.LabelField("Available Directories:"); string[] dirs = Directory.GetDirectories(parentDir); foreach (string s in dirs) { EditorGUILayout.LabelField(s); } } EditorGUILayout.Space(); } if (opt == OutputOption.CreateInSelectedDirectory || opt == OutputOption.CreateInCacheDirectory) { var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data, null); using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir))) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Highlight in Project Window", GUILayout.Width(180f))) { var folder = AssetDatabase.LoadMainAssetAtPath(outputDir); EditorGUIUtility.PingObject(folder); } } } } } } } GUILayout.Space(8f); foreach (var s in m_entries) { DrawGeneratorSetting(s, node, streamManager, editor, onValueChanged); GUILayout.Space(10f); } if (m_removingEntry != null) { using (new RecordUndoScope("Remove Generator", node)) { RemoveGeneratorEntry(node, m_removingEntry); m_removingEntry = null; onValueChanged(); } } GUILayout.Space(8); if (GUILayout.Button("Add Generator")) { using (new RecordUndoScope("Add Generator", node)) { AddEntry(node); onValueChanged(); } } }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { EditorGUILayout.HelpBox("Create Prefab From Group: Create prefab from incoming group of assets, using assigned script.", MessageType.Info); editor.UpdateNodeName(node); var builder = m_instance.Get <IPrefabBuilder>(editor.CurrentEditingGroup); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var map = PrefabBuilderUtility.GetAttributeAssemblyQualifiedNameMap(); if (map.Count > 0) { using (new GUILayout.HorizontalScope()) { GUILayout.Label("PrefabBuilder"); var guiName = PrefabBuilderUtility.GetPrefabBuilderGUIName(m_instance.ClassName); if (GUILayout.Button(guiName, "Popup", GUILayout.MinWidth(150f))) { var builders = map.Keys.ToList(); if (builders.Count > 0) { NodeGUI.ShowTypeNamesMenu(guiName, builders, (string selectedGUIName) => { using (new RecordUndoScope("Change PrefabBuilder class", node, true)) { builder = PrefabBuilderUtility.CreatePrefabBuilder(selectedGUIName); m_instance.Set(editor.CurrentEditingGroup, builder); onValueChanged(); } } ); } } MonoScript s = TypeUtility.LoadMonoScript(m_instance.ClassName); using (new EditorGUI.DisabledScope(s == null)) { if (GUILayout.Button("Edit", GUILayout.Width(50))) { AssetDatabase.OpenAsset(s, 0); } } } ReplacePrefabOptions opt = (ReplacePrefabOptions)EditorGUILayout.EnumPopup("Prefab Replace Option", m_replacePrefabOptions, GUILayout.MinWidth(150f)); if (m_replacePrefabOptions != opt) { using (new RecordUndoScope("Change Prefab Replace Option", node, true)) { m_replacePrefabOptions = opt; onValueChanged(); } opt = m_replacePrefabOptions; } } else { if (!string.IsNullOrEmpty(m_instance.ClassName)) { EditorGUILayout.HelpBox( string.Format( "Your PrefabBuilder script {0} is missing from assembly. Did you delete script?", m_instance.ClassName), MessageType.Info); } else { string[] menuNames = Model.Settings.GUI_TEXT_MENU_GENERATE_PREFABBUILDER.Split('/'); EditorGUILayout.HelpBox( string.Format( "You need to create at least one PrefabBuilder script to use this node. To start, select {0}>{1}>{2} menu and create new script from template.", menuNames[1], menuNames[2], menuNames[3] ), MessageType.Info); } } GUILayout.Space(10f); editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope()) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_instance.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { if (enabled) { m_instance.CopyDefaultValueTo(editor.CurrentEditingGroup); m_outputDir[editor.CurrentEditingGroup] = m_outputDir.DefaultValue; m_outputOption[editor.CurrentEditingGroup] = m_outputOption.DefaultValue; } else { m_instance.Remove(editor.CurrentEditingGroup); m_outputDir.Remove(editor.CurrentEditingGroup); m_outputOption.Remove(editor.CurrentEditingGroup); } onValueChanged(); }); using (disabledScope) { OutputOption opt = (OutputOption)m_outputOption[editor.CurrentEditingGroup]; var newOption = (OutputOption)EditorGUILayout.EnumPopup("Output Option", opt); if (newOption != opt) { using (new RecordUndoScope("Change Output Option", node, true)){ m_outputOption[editor.CurrentEditingGroup] = (int)newOption; onValueChanged(); } opt = newOption; } using (new EditorGUI.DisabledScope(opt == OutputOption.CreateInCacheDirectory)) { var newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder", m_outputDir[editor.CurrentEditingGroup], Application.dataPath, (string folderSelected) => { string basePath = Application.dataPath; if (basePath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(basePath); if (index >= 0) { folderSelected = folderSelected.Substring(basePath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newDirPath != m_outputDir[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Output Directory", node, true)){ m_outputDir[editor.CurrentEditingGroup] = newDirPath; onValueChanged(); } } var dirPath = Path.Combine(Application.dataPath, m_outputDir [editor.CurrentEditingGroup]); if (opt == OutputOption.CreateInSelectedDirectory && !string.IsNullOrEmpty(m_outputDir [editor.CurrentEditingGroup]) && !Directory.Exists(dirPath)) { using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(m_outputDir[editor.CurrentEditingGroup] + " does not exist."); if (GUILayout.Button("Create directory")) { Directory.CreateDirectory(dirPath); AssetDatabase.Refresh(); } } EditorGUILayout.Space(); string parentDir = Path.GetDirectoryName(m_outputDir[editor.CurrentEditingGroup]); if (Directory.Exists(parentDir)) { EditorGUILayout.LabelField("Available Directories:"); string[] dirs = Directory.GetDirectories(parentDir); foreach (string s in dirs) { EditorGUILayout.LabelField(s); } } EditorGUILayout.Space(); } var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data); using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir))) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Highlight in Project Window", GUILayout.Width(180f))) { var folder = AssetDatabase.LoadMainAssetAtPath(outputDir); EditorGUIUtility.PingObject(folder); } } } } GUILayout.Space(8f); if (builder != null) { Action onChangedAction = () => { using (new RecordUndoScope("Change PrefabBuilder Setting", node)) { m_instance.Set(editor.CurrentEditingGroup, builder); onValueChanged(); } }; builder.OnInspectorGUI(onChangedAction); } } } } }
public void Remove(BuildTarget target) { Remove(BuildTargetUtility.TargetToGroup(target)); }
public void CopyDefaultValueTo(BuildTarget t) { CopyDefaultValueTo(BuildTargetUtility.TargetToGroup(t)); }
public T Get <T>(BuildTarget t) { return(Get <T>(BuildTargetUtility.TargetToGroup(t))); }
public ExecuteResultTreeItem(ExecuteGraphResult r) : base(s_id++, 0, string.Empty) { m_result = r; displayName = string.Format("{0}({1}):{2}", Path.GetFileNameWithoutExtension(r.GraphAssetPath), BuildTargetUtility.TargetToHumaneString(r.Target), (r.IsAnyIssueFound)?"Failed" : "Good"); }
public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged) { if (m_enabledBundleOptions == null) { return; } EditorGUILayout.HelpBox("Build Asset Bundles: Build asset bundles with given asset bundle settings.", MessageType.Info); editor.UpdateNodeName(node); bool newOverwrite = EditorGUILayout.ToggleLeft("Keep AssetImporter settings for variants", m_overwriteImporterSetting); if (newOverwrite != m_overwriteImporterSetting) { using (new RecordUndoScope("Remove Target Bundle Options", node, true)){ m_overwriteImporterSetting = newOverwrite; onValueChanged(); } } GUILayout.Space(10f); //Show target configuration tab editor.DrawPlatformSelector(node); using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { var disabledScope = editor.DrawOverrideTargetToggle(node, m_enabledBundleOptions.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) => { using (new RecordUndoScope("Remove Target Bundle Options", node, true)){ if (enabled) { m_enabledBundleOptions[editor.CurrentEditingGroup] = m_enabledBundleOptions.DefaultValue; m_outputDir[editor.CurrentEditingGroup] = m_outputDir.DefaultValue; m_outputOption[editor.CurrentEditingGroup] = m_outputOption.DefaultValue; m_manifestName[editor.CurrentEditingGroup] = m_manifestName.DefaultValue; } else { m_enabledBundleOptions.Remove(editor.CurrentEditingGroup); m_outputDir.Remove(editor.CurrentEditingGroup); m_outputOption.Remove(editor.CurrentEditingGroup); m_manifestName.Remove(editor.CurrentEditingGroup); } onValueChanged(); } }); using (disabledScope) { OutputOption opt = (OutputOption)m_outputOption[editor.CurrentEditingGroup]; var newOption = (OutputOption)EditorGUILayout.EnumPopup("Output Option", opt); if (newOption != opt) { using (new RecordUndoScope("Change Output Option", node, true)){ m_outputOption[editor.CurrentEditingGroup] = (int)newOption; onValueChanged(); } } using (new EditorGUI.DisabledScope(opt == OutputOption.BuildInCacheDirectory)) { var newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder", m_outputDir[editor.CurrentEditingGroup], Application.dataPath + "/../", (string folderSelected) => { var projectPath = Directory.GetParent(Application.dataPath).ToString(); if (projectPath == folderSelected) { folderSelected = string.Empty; } else { var index = folderSelected.IndexOf(projectPath); if (index >= 0) { folderSelected = folderSelected.Substring(projectPath.Length + index); if (folderSelected.IndexOf('/') == 0) { folderSelected = folderSelected.Substring(1); } } } return(folderSelected); } ); if (newDirPath != m_outputDir[editor.CurrentEditingGroup]) { using (new RecordUndoScope("Change Output Directory", node, true)){ m_outputDir[editor.CurrentEditingGroup] = newDirPath; onValueChanged(); } } var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data, false, false); if (opt == OutputOption.ErrorIfNoOutputDirectoryFound && editor.CurrentEditingGroup != BuildTargetGroup.Unknown && !string.IsNullOrEmpty(m_outputDir [editor.CurrentEditingGroup]) && !Directory.Exists(outputDir)) { using (new EditorGUILayout.HorizontalScope()) { Debug.LogWarning("BundleBuilder" + outputDir + " does not exist."); EditorGUILayout.LabelField(outputDir + " does not exist."); if (GUILayout.Button("Create directory")) { Directory.CreateDirectory(outputDir); } } EditorGUILayout.Space(); string parentDir = Path.GetDirectoryName(m_outputDir[editor.CurrentEditingGroup]); if (Directory.Exists(parentDir)) { EditorGUILayout.LabelField("Available Directories:"); string[] dirs = Directory.GetDirectories(parentDir); foreach (string s in dirs) { EditorGUILayout.LabelField(s); } } EditorGUILayout.Space(); } using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir))) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); #if UNITY_EDITOR_OSX string buttonName = "Reveal in Finder"; #else string buttonName = "Show in Explorer"; #endif if (GUILayout.Button(buttonName)) { EditorUtility.RevealInFinder(outputDir); } } } EditorGUILayout.HelpBox("You can use '{Platform}' variable for Output Directory path to include platform name.", MessageType.Info); } GUILayout.Space(8f); var manifestName = m_manifestName[editor.CurrentEditingGroup]; var newManifestName = EditorGUILayout.TextField("Manifest Name", manifestName); if (newManifestName != manifestName) { using (new RecordUndoScope("Change Manifest Name", node, true)){ m_manifestName[editor.CurrentEditingGroup] = newManifestName; onValueChanged(); } } GUILayout.Space(8f); int bundleOptions = m_enabledBundleOptions[editor.CurrentEditingGroup]; bool isDisableWriteTypeTreeEnabled = 0 < (bundleOptions & (int)BuildAssetBundleOptions.DisableWriteTypeTree); bool isIgnoreTypeTreeChangesEnabled = 0 < (bundleOptions & (int)BuildAssetBundleOptions.IgnoreTypeTreeChanges); // buildOptions are validated during loading. Two flags should not be true at the same time. UnityEngine.Assertions.Assert.IsFalse(isDisableWriteTypeTreeEnabled && isIgnoreTypeTreeChangesEnabled); bool isSomethingDisabled = isDisableWriteTypeTreeEnabled || isIgnoreTypeTreeChangesEnabled; foreach (var option in Model.Settings.BundleOptionSettings) { // contains keyword == enabled. if not, disabled. bool isEnabled = (bundleOptions & (int)option.option) != 0; bool isToggleDisabled = (option.option == BuildAssetBundleOptions.DisableWriteTypeTree && isIgnoreTypeTreeChangesEnabled) || (option.option == BuildAssetBundleOptions.IgnoreTypeTreeChanges && isDisableWriteTypeTreeEnabled); using (new EditorGUI.DisabledScope(isToggleDisabled)) { var result = EditorGUILayout.ToggleLeft(option.description, isEnabled); if (result != isEnabled) { using (new RecordUndoScope("Change Bundle Options", node, true)){ bundleOptions = (result) ? ((int)option.option | bundleOptions) : (((~(int)option.option)) & bundleOptions); m_enabledBundleOptions[editor.CurrentEditingGroup] = bundleOptions; onValueChanged(); } } } } if (isSomethingDisabled) { EditorGUILayout.HelpBox("'Disable Write Type Tree' and 'Ignore Type Tree Changes' can not be used together.", MessageType.Info); } } } }
public void Build() { m_result.Clear(); var currentCount = 0f; var totalCount = (float)GetTotalNodeCount(m_currentCollection) * BatchBuildConfig.GetConfig().BuildTargets.Count; Model.NodeData lastNode = null; foreach (var t in BatchBuildConfig.GetConfig().BuildTargets) { Action <Model.NodeData, string, float> updateHandler = (node, message, progress) => { if (lastNode != node) { // do not add count on first node visit to // calcurate percantage correctly if (lastNode != null) { ++currentCount; } lastNode = node; } var currentNodeProgress = progress * (1.0f / totalCount); var currentTotalProgress = (currentCount / totalCount) + currentNodeProgress; var title = string.Format("{2} - Processing Asset Graphs[{0}/{1}]", currentCount, totalCount, BuildTargetUtility.TargetToHumaneString(t)); var info = $"{node.Name}:{message}"; EditorUtility.DisplayProgressBar(title, "Processing " + info, currentTotalProgress); }; var result = AssetGraphUtility.ExecuteGraphCollection(t, m_currentCollection, updateHandler); EditorUtility.ClearProgressBar(); m_result.AddRange(result); m_lastBuildTimestamp = DateTime.UtcNow.ToFileTimeUtc(); m_executeResultTree.ReloadAndSelectLast(); m_parent.Repaint(); } }
public void Set(BuildTarget t, object value) { Set(BuildTargetUtility.TargetToGroup(t), value); }
public bool IsEqual(VideoClipImporter target, VideoClipImporter reference) { if (!CompareVideoImporterTargetSettings(target.defaultTargetSettings, reference.defaultTargetSettings)) { return(false); } /* read only properties. ImportSettingConfigurator will not use these properties for diff. */ /* * importer.frameCount * importer.frameRate * importer.isPlayingPreview * importer.outputFileSize * importer.sourceAudioTrackCount * importer.sourceFileSize * importer.sourceHasAlpha */ if (target.deinterlaceMode != reference.deinterlaceMode) { return(false); } if (target.flipHorizontal != reference.flipHorizontal) { return(false); } if (target.flipVertical != reference.flipVertical) { return(false); } if (target.importAudio != reference.importAudio) { return(false); } if (target.keepAlpha != reference.keepAlpha) { return(false); } if (target.linearColor != reference.linearColor) { return(false); } if (target.quality != reference.quality) { return(false); } if (target.useLegacyImporter != reference.useLegacyImporter) { return(false); } #if UNITY_2017_2_OR_NEWER if (target.pixelAspectRatioDenominator != reference.pixelAspectRatioDenominator) { return(false); } if (target.pixelAspectRatioNumerator != reference.pixelAspectRatioNumerator) { return(false); } #endif foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.VideoClipImporter); try { var r = reference.GetTargetSettings(platformName); var t = target.GetTargetSettings(platformName); // if both targets are null - keep going if (r == null && t == null) { continue; } if (r == null || t == null) { return(false); } if (!CompareVideoImporterTargetSettings(r, t)) { return(false); } } catch (Exception e) { LogUtility.Logger.LogError("VideoClipImporter", string.Format("Failed to test equality setting for {0}: file :{1} type:{3} reason:{2}", platformName, target.assetPath, e.Message, e.GetType().ToString())); } } return(true); }
public bool ContainsValueOf(BuildTarget target) { return(ContainsValueOf(BuildTargetUtility.TargetToGroup(target))); }
public BuildTargetTreeItem(BuildTarget t) : base((int)t, 0, string.Empty) { m_group = BuildTargetUtility.TargetToGroup(t); m_target = t; displayName = BuildTargetUtility.TargetToHumaneString(m_target); }
private void OverwriteImportSettings(VideoClipImporter target, VideoClipImporter reference) { /* * defaultTargetSettings Default values for the platform-specific import settings. * deinterlaceMode Images are deinterlaced during transcode. This tells the importer how to interpret fields in the source, if any. * flipHorizontal Apply a horizontal flip during import. * flipVertical Apply a vertical flip during import. * frameCount Number of frames in the clip. * frameRate Frame rate of the clip. * importAudio Import audio tracks from source file. * isPlayingPreview Whether the preview is currently playing. * keepAlpha Whether to keep the alpha from the source into the transcoded clip. * linearColor Used in legacy import mode. Same as MovieImport.linearTexture. * outputFileSize Size in bytes of the file once imported. * quality Used in legacy import mode. Same as MovieImport.quality. * sourceAudioTrackCount Number of audio tracks in the source file. * sourceFileSize Size in bytes of the file before importing. * sourceHasAlpha True if the source file has a channel for per-pixel transparency. * useLegacyImporter Whether to import a MovieTexture (legacy) or a VideoClip. */ target.defaultTargetSettings = reference.defaultTargetSettings; target.deinterlaceMode = reference.deinterlaceMode; target.flipHorizontal = reference.flipHorizontal; target.flipVertical = reference.flipVertical; target.importAudio = reference.importAudio; target.keepAlpha = reference.keepAlpha; target.linearColor = reference.linearColor; target.quality = reference.quality; target.useLegacyImporter = reference.useLegacyImporter; foreach (var g in NodeGUIUtility.SupportedBuildTargetGroups) { var platformName = BuildTargetUtility.TargetToAssetBundlePlatformName(g, BuildTargetUtility.PlatformNameType.VideoClipImporter); try { var setting = reference.GetTargetSettings(platformName); if (setting != null) { target.SetTargetSettings(platformName, setting); } else { target.ClearTargetSettings(platformName); } } catch (Exception e) { LogUtility.Logger.LogWarning("VideoClipImporter", string.Format("Failed to set override setting for platform {0}: file :{1} \\nreason:{2}", platformName, target.assetPath, e.Message)); } } /* read only */ /* * importer.frameCount * importer.frameRate * importer.isPlayingPreview * importer.outputFileSize * importer.sourceAudioTrackCount * importer.sourceFileSize * importer.sourceHasAlpha * importer.pixelAspectRatioDenominator * importer.pixelAspectRatioNumerator */ }
public void SetupPlatformButtons() { SetupSupportedBuildTargets(); var buttons = new List <PlatformButton> (); Dictionary <BuildTargetGroup, string> icons = new Dictionary <BuildTargetGroup, string> { { BuildTargetGroup.Android, "BuildSettings.Android.Small" }, { BuildTargetGroup.iOS, "BuildSettings.iPhone.Small" }, { BuildTargetGroup.PS4, "BuildSettings.PS4.Small" }, { BuildTargetGroup.PSM, "BuildSettings.PSM.Small" }, { BuildTargetGroup.PSP2, "BuildSettings.PSP2.Small" }, #if !UNITY_2017_3_OR_NEWER { BuildTargetGroup.SamsungTV, "BuildSettings.Android.Small" }, #endif { BuildTargetGroup.Standalone, "BuildSettings.Standalone.Small" }, { BuildTargetGroup.Tizen, "BuildSettings.Tizen.Small" }, { BuildTargetGroup.tvOS, "BuildSettings.tvOS.Small" }, { BuildTargetGroup.Unknown, "BuildSettings.Standalone.Small" }, { BuildTargetGroup.WebGL, "BuildSettings.WebGL.Small" }, { BuildTargetGroup.WiiU, "BuildSettings.WiiU.Small" }, { BuildTargetGroup.WSA, "BuildSettings.WP8.Small" }, { BuildTargetGroup.XboxOne, "BuildSettings.XboxOne.Small" } #if !UNITY_5_5_OR_NEWER , { BuildTargetGroup.XBOX360, "BuildSettings.Xbox360.Small" }, { BuildTargetGroup.Nintendo3DS, "BuildSettings.N3DS.Small" }, { BuildTargetGroup.PS3, "BuildSettings.PS3.Small" } #endif #if UNITY_5_5_OR_NEWER , { BuildTargetGroup.N3DS, "BuildSettings.N3DS.Small" } #endif #if UNITY_5_6 || UNITY_5_6_OR_NEWER , { BuildTargetGroup.Facebook, "BuildSettings.Facebook.Small" }, { BuildTargetGroup.Switch, "BuildSettings.Switch.Small" } #endif }; buttons.Add(new PlatformButton(new GUIContent("Default", "Default settings"), BuildTargetGroup.Unknown)); foreach (var g in supportedBuildTargetGroups) { buttons.Add(new PlatformButton(new GUIContent(GetPlatformIcon(icons[g]), BuildTargetUtility.GroupToHumaneString(g)), g)); } this.platformButtons = buttons.ToArray(); }