Skip to content

Commit deb8db5

Browse files
claasicmob-sakai
authored andcommitted
[fix] fix loop variable names, add span fallback for older Unity versions
1 parent 0f0a97a commit deb8db5

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

Packages/src/Runtime/Internal/Utilities/ShaderVariantRegistry.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ public Shader FindOptionalShader(Shader shader,
8888
// Find optional shader.
8989
Shader optionalShader;
9090
var count = m_OptionalShaders.Count;
91-
for (var index = 0; index < count; index++)
91+
for (var i = 0; i < count; i++)
9292
{
93-
var pair = m_OptionalShaders[index];
93+
var pair = m_OptionalShaders[i];
9494
if (pair.key != shaderName) continue;
9595
optionalShader = Shader.Find(pair.value);
9696
if (!optionalShader) continue;

Packages/src/Runtime/UIEffectContext.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,14 @@ private static float GetMultiplier(float deg)
691691
return Mathf.Max(Mathf.Abs(cos - sin), Mathf.Abs(cos + sin));
692692
}
693693

694+
#if UNITY_2021_2_OR_NEWER
694695
private static void SetKeyword(Material material, Span<string> keywords, int index)
696+
#else
697+
private static void SetKeyword(Material material, string[] keywords, int index)
698+
#endif
695699
{
696700
var length = keywords.Length;
697-
if (index < keywords.Length && !string.IsNullOrEmpty(keywords[index]))
701+
if (index < length && !string.IsNullOrEmpty(keywords[index]))
698702
{
699703
material.EnableKeyword(keywords[index]);
700704
}

Packages/src/Runtime/Utilities/GraphicProxy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ public static void Register(GraphicProxy proxy)
1616
{
1717
// Register only once.
1818
var count = s_Proxies.Count;
19-
for (var index = 0; index < count; index++)
19+
for (var i = 0; i < count; i++)
2020
{
21-
var p = s_Proxies[index];
21+
var p = s_Proxies[i];
2222
if (p.GetType() == proxy.GetType()) return;
2323
}
2424

0 commit comments

Comments
 (0)