Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Commit

Permalink
Log warnings when compiling if a script name doesn't match the file name
Browse files Browse the repository at this point in the history
- Unity requires that the script name matches the file name exactly in order for many editor features to work as expected. It's broken to the point that I don't think I can just work around it without other odd issues.
  • Loading branch information
MerlinVR committed Dec 11, 2020
1 parent c923fdb commit f4125e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion Assets/UdonSharp/Editor/UdonSharpCompilationModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public CompileTaskResult Compile(List<ClassDefinition> classDefinitions, Microso
debugInfo.FinalizeDebugInfo();

UdonSharpEditorCache.Instance.SetDebugInfo(programAsset, isEditorBuild ? UdonSharpEditorCache.DebugInfoType.Editor : UdonSharpEditorCache.DebugInfoType.Client, debugInfo);
//programAsset.debugInfo = debugInfo;
}

return result;
Expand Down
6 changes: 6 additions & 0 deletions Assets/UdonSharp/Editor/UdonSharpCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ List<ClassDefinition> BindPrograms(List<(UdonSharpProgramAsset, Microsoft.CodeAn
if (bindResult.compileErrors.Count == 0)
{
classDefinitions.Add(bindResult.classDefinition);

if (bindResult.sourceScript.GetClass() == null &&
bindResult.classDefinition.userClassType.Name != Path.GetFileNameWithoutExtension(AssetDatabase.GetAssetPath(bindResult.sourceScript)))
{
Debug.LogWarning($"[<color=#FF00FF>UdonSharp</color>] {AssetDatabase.GetAssetPath(bindResult.sourceScript)}: Class name does not match file name, Unity requires that both names match exactly for the editor to work properly.", bindResult.sourceScript);
}
}
else
{
Expand Down

0 comments on commit f4125e7

Please sign in to comment.