Skip to content

Commit fcef208

Browse files
author
Unity Technologies
committed
Unity 2023.1.0a13 C# reference source code
1 parent 5c849fb commit fcef208

File tree

63 files changed

+1276
-402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1276
-402
lines changed

Editor/Mono/2D/SpriteAtlas/EditorSpriteAtlas.bindings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,7 @@ public static class SpriteAtlasExtensions
123123
extern internal static bool GetSecondaryColorSpace([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string secondaryTextureName);
124124
extern internal static void SetSecondaryColorSpace([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string secondaryTextureName, bool srGB);
125125
extern internal static void DeleteSecondaryPlatformSettings([NotNull("NullExceptionObject")] this SpriteAtlas spriteAtlas, string secondaryTextureName);
126+
extern internal static string GetSecondaryTextureNameInAtlas(string atlasTextureName);
127+
extern internal static string GetPageNumberInAtlas(string atlasTextureName);
126128
}
127129
}

Editor/Mono/2D/SpriteAtlas/SpriteAtlasImporterInspector.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -875,24 +875,10 @@ void CachePreviewTexture()
875875
m_OptionValues = new int[m_TotalPages];
876876
for (int i = 0; i < m_TotalPages; ++i)
877877
{
878-
// Example texName:
879-
// pageNum secondaryName
880-
// V | V |
881-
// sactx-2-128x128-Uncompressed-My Sprite Atlas-0fe925a#_Glow-var-0.5...
882878
string texName = m_PreviewTextures[i].name;
883-
string pageNum = texName.Split('-')[1];
884-
int hashTag = texName.IndexOf('#');
885-
int dashAfterHashTag = hashTag != -1 ? texName.IndexOf('-', hashTag) : -1;
886-
887-
string secondaryName;
888-
if (hashTag == -1)
889-
secondaryName = "";
890-
else if (dashAfterHashTag == -1)
891-
secondaryName = "-" + texName.Substring(hashTag + 1);
892-
else
893-
secondaryName = "-" + texName.Substring(hashTag + 1, dashAfterHashTag - hashTag - 1);
894-
895-
m_OptionDisplays[i] = string.Format("#{0}{1}", pageNum, secondaryName);
879+
var pageNum = SpriteAtlasExtensions.GetPageNumberInAtlas(texName);
880+
var secondaryName = SpriteAtlasExtensions.GetSecondaryTextureNameInAtlas(texName);
881+
m_OptionDisplays[i] = secondaryName == "" ? string.Format("MainTex - Page ({0})", pageNum) : string.Format("{0} - Page ({1})", secondaryName, pageNum);
896882
m_OptionValues[i] = i;
897883
}
898884
}

Editor/Mono/2D/SpriteAtlas/SpriteAtlasInspector.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -748,24 +748,10 @@ void CachePreviewTexture()
748748
m_OptionValues = new int[m_TotalPages];
749749
for (int i = 0; i < m_TotalPages; ++i)
750750
{
751-
// Example texName:
752-
// pageNum secondaryName
753-
// V | V |
754-
// sactx-2-128x128-Uncompressed-My Sprite Atlas-0fe925a#_Glow-var-0.5...
755751
string texName = m_PreviewTextures[i].name;
756-
string pageNum = texName.Split('-')[1];
757-
int hashTag = texName.IndexOf('#');
758-
int dashAfterHashTag = hashTag != -1 ? texName.IndexOf('-', hashTag) : -1;
759-
760-
string secondaryName;
761-
if (hashTag == -1)
762-
secondaryName = "";
763-
else if (dashAfterHashTag == -1)
764-
secondaryName = "-" + texName.Substring(hashTag + 1);
765-
else
766-
secondaryName = "-" + texName.Substring(hashTag + 1, dashAfterHashTag - hashTag - 1);
767-
768-
m_OptionDisplays[i] = string.Format("#{0}{1}", pageNum, secondaryName);
752+
var pageNum = SpriteAtlasExtensions.GetPageNumberInAtlas(texName);
753+
var secondaryName = SpriteAtlasExtensions.GetSecondaryTextureNameInAtlas(texName);
754+
m_OptionDisplays[i] = secondaryName == "" ? string.Format("MainTex - Page ({0})", pageNum) : string.Format("{0} - Page ({1})", secondaryName, pageNum);
769755
m_OptionValues[i] = i;
770756
}
771757
}

Editor/Mono/AssetPipeline/TextureImporter.bindings.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,15 @@ public TextureImporterFormat GetAutomaticFormat(string platform)
133133
if (bp.name == platform)
134134
{
135135
return DefaultFormatFromTextureParameters(settings,
136-
platformSettings,
136+
!platformSettings.overridden ? GetDefaultPlatformTextureSettings() : platformSettings,
137137
DoesSourceTextureHaveAlpha(),
138138
IsSourceTextureHDR(),
139139
bp.defaultTarget);
140+
141+
// Regarding the "GetDefaultPlatformTextureSettings" call: in case 1281084, we made it so that platform settings stop automatically
142+
// resetting to the default platform's settings when the platform override is disabled. This introduced a regression where
143+
// "GetAutomaticFormat" would not return the actual format used by platforms with a disabled override, (as in, the one indicated in
144+
// the default platform's settings) which is why we pass in the default platform's settings instead.
140145
}
141146
}
142147

Editor/Mono/BuildPipeline.bindings.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,13 @@ public static BuildReport BuildPlayer(BuildPlayerOptions buildPlayerOptions)
322322
{
323323
if ((buildPlayerOptions.target == BuildTarget.StandaloneLinux64 ||
324324
buildPlayerOptions.target == BuildTarget.StandaloneOSX ||
325-
buildPlayerOptions.target == BuildTarget.StandaloneWindows) &&
325+
buildPlayerOptions.target == BuildTarget.StandaloneWindows ||
326+
buildPlayerOptions.target == BuildTarget.StandaloneWindows64) &&
326327
buildPlayerOptions.subtarget == (int)StandaloneBuildSubtarget.Default)
327328
{
328329
buildPlayerOptions.subtarget = (int) EditorUserBuildSettings.standaloneBuildSubtarget;
329330
}
331+
EditorUserBuildSettings.standaloneBuildSubtarget = (StandaloneBuildSubtarget) buildPlayerOptions.subtarget;
330332

331333
return BuildPlayer(buildPlayerOptions.scenes, buildPlayerOptions.locationPathName, buildPlayerOptions.assetBundleManifestPath, buildPlayerOptions.targetGroup, buildPlayerOptions.target, buildPlayerOptions.subtarget, buildPlayerOptions.options, buildPlayerOptions.extraScriptingDefines);
332334
}

0 commit comments

Comments
 (0)