Search Issue Tracker
Fixed
Votes
0
Found in [Package]
1.7.5
1.7.6
Issue ID
UVSB-2029
Regression
No
Additional editor assemblies are not detected correctly
Reproducible on:
- VS version: 1.7.6
- Unity version: 2021.2.2f1
Case 1:
Note: This bug came from the forum: https://forum.unity.com/threads/additional-editor-assemblies-are-not-detected-correctly.1197328/
If my editor assembly (created using an assembly definition) is not one of the special names Assembly-CSharp-Editor or Assembly-CSharp-Editor-firstpass, I have to have an [assembly: AssemblyIsEditorAssembly] somewhere in it. But when I do that, watch what happens in the function above: _editorAssemblyCache.TryGetValue returns false and sets isEditor to default (false), then Attribute.IsDefined returns true, and a key value pair of (assembly, false) is added to _editorAssemblyCache. Thereafter, _editorAssemblyCache keeps serving the wrong false value.
- Consider this function in Codebase.cs (package version 1.7.6):
{code:java}
Code (CSharp):
private static bool IsEditorAssembly(Assembly assembly)
{
// assembly.GetName() is surprisingly expensive, keep a cache
if (_editorAssemblyCache.TryGetValue(assembly, out var isEditor))
return isEditor;
if (Attribute.IsDefined(assembly, typeof(AssemblyIsEditorAssembly)))
{
_editorAssemblyCache.Add(assembly, isEditor); // <== isEditor is always false!
return true;
}
var isEditorAssembly = IsEditorAssembly(assembly.GetName());
_editorAssemblyCache.Add(assembly, isEditorAssembly);
return isEditorAssembly;
}
{code}
- Workaround from the user: make sure your editor assembly uses something from UnityEditor.CoreModule, for example:
{code:java}
Code (CSharp):
internal class DummyEditorDependency : UnityEditor.Editor { }
{code}
Case 2:
Small bug in Codebase.IsEditorAssembly() (1.7.5, also 1.7.6): l.330 _editorAssemblyCache.Add(assembly, isEditor); should be _editorAssemblyCache.Add(assembly, true); At the moment it's not possible to add visual scripting editor extensions in separate Assemblies because of this. (edited)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note:
PR: https://github.cds.internal.unity3d.com/unity/com.unity.visualscripting/pull/506