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
- [Android] Audio sound is lower in the Player compared to the native music player
- Feet slide and misalign when playing retargeted animations
- IndexOutOfRangeException is thrown in NativePassCompiler when a graphics buffer is used in more than 5 render passes
- "Undo Stack Overflow" error is thrown, and Undo History is deleted when multiselected GameObjects are reparented to their GrandParents
- SearchColumn of type "ObjectReference" does not get refreshed for the custom SearchProvider when lighting generation finishes
Resolution Note:
PR: https://github.cds.internal.unity3d.com/unity/com.unity.visualscripting/pull/506