Skip to content

Fixed 6.6 nullref caused by getting the removed GetPackedSprites method - #50

Merged
yasirkula merged 7 commits into
yasirkula:masterfrom
TNQKhang:6.6-fixes
Sep 12, 2026
Merged

yasirkula merged 7 commits into
yasirkula:masterfrom
TNQKhang:6.6-fixes

Conversation

@TNQKhang

@TNQKhang TNQKhang commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Unity removed the private SpriteAtlasExtensions.GetPackedSprites method in Unity 6.6, so opening the asset detector window generates this nullref, rendering it unusable:

ArgumentNullException: Value cannot be null.
Parameter name: method
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <c5ae8a4eeb824526b5df2932bc2395e0>:0)
System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure) (at <c5ae8a4eeb824526b5df2932bc2395e0>:0)
System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) (at <c5ae8a4eeb824526b5df2932bc2395e0>:0)
AssetUsageDetectorNamespace.AssetUsageDetector..cctor () (at ./Library/PackageCache/com.yasirkula.assetusagedetector@69f7ee5a27fc/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorSearchFunctions.cs:187)
Rethrow as TypeInitializationException: The type initializer for 'AssetUsageDetectorNamespace.AssetUsageDetector' threw an exception.
AssetUsageDetectorNamespace.AssetUsageDetectorWindow..ctor () (at ./Library/PackageCache/com.yasirkula.assetusagedetector@69f7ee5a27fc/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorWindow.cs:49)
UnityEngine.ScriptableObject:CreateInstance()
AssetUsageDetectorNamespace.AssetUsageDetectorWindow:GetWindow(WindowFilter) (at ./Library/PackageCache/com.yasirkula.assetusagedetector@69f7ee5a27fc/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorWindow.cs:169)
AssetUsageDetectorNamespace.AssetUsageDetectorWindow:OpenActiveWindow() (at ./Library/PackageCache/com.yasirkula.assetusagedetector@69f7ee5a27fc/Plugins/AssetUsageDetector/Editor/AssetUsageDetectorWindow.cs:188)

I added new GetPackedSprites logic similar to the one in SpriteAtlasReportUtility in the Unity 2D Tooling package.
Differences between the two new and old behaviours:

  • Old behaviour: doesn't count sub-assets if Sprite Atlas packing is set to Enabled for builds or Disabled.
  • New behaviour: always counts the sub-assets, even if Sprite Atlas packing is set to Disabled.

@yasirkula
yasirkula merged commit 4e4321b into yasirkula:master Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants