Skip to content

Commit 61ecbd8

Browse files
author
András Kurai
committed
Don't create empty classes
1 parent 59d4c4a commit 61ecbd8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

UnityResourceGenerator/Assets/AutSoft.UnityResourceGenerator.Sample/ResourcePaths.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,5 @@ public static partial class AudioClips
3636
public const string Coin = "Coin";
3737
public static AudioClip LoadCoin() => Resources.Load<AudioClip>(Coin);
3838
}
39-
public static partial class Sprites
40-
{
41-
}
42-
public static partial class TextAssets
43-
{
44-
}
45-
public static partial class Fonts
46-
{
47-
}
4839
}
4940
}

UnityResourceGenerator/Assets/AutSoft.UnityResourceGenerator/Editor/Generation/Modules/AllResources.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public static partial class {data.ClassName}
6363
throw new InvalidOperationException("Found duplicate file names");
6464
}
6565

66+
if (values.Length == 0)
67+
{
68+
LogFinished();
69+
70+
return string.Empty;
71+
}
72+
6673
var output = values
6774
.Aggregate(
6875
new StringBuilder().Append(classBegin),
@@ -85,9 +92,11 @@ public static partial class {data.ClassName}
8592
.AppendLine(classEnd)
8693
.ToString();
8794

88-
context.Info($"Finished generating {data.ClassName}");
95+
LogFinished();
8996

9097
return output;
98+
99+
void LogFinished() => context.Info($"Finished generating {data.ClassName}");
91100
}
92101

93102
private static (bool canLoad, string baseFolder) GetBaseFolder(string filePath, bool isResource, ResourceContext context)

0 commit comments

Comments
 (0)