I can’t say I’m sure this is a bug, but the behavior is very strange and I’m not sure how to fix it. I’m using the code from this asset to generate a tile atlas texture dynamically.
Everything works fine. The texture/sprites are all created fine and seem to have no other issue than the fact that I get this error every time:
InvalidOperationException: Sequence contains no matching element
System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
UnityEditor.U2D.Animation.SpritePostProcess.PostProcessBoneData (UnityEditor.U2D.Sprites.ISpriteEditorDataProvider spriteDataProvider, System.Single definitionScale, UnityEngine.Sprite[] sprites) (at Library/PackageCache/com.unity.2d.animation@3.2.5/Editor/SpritePostProcess.cs:107)
UnityEditor.U2D.Animation.SpritePostProcess.OnPostprocessSprites (UnityEngine.Texture2D texture, UnityEngine.Sprite[] sprites) (at Library/PackageCache/com.unity.2d.animation@3.2.5/Editor/SpritePostProcess.cs:29)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethodIfAvailable (System.Object target, System.String methodName, System.Object[] args) (at <5984c823338e4ca69b7a0ca01115425e>:0)
UnityEditor.AssetPostprocessingInternal.CallPostProcessMethods (System.String methodName, System.Object[] args) (at <5984c823338e4ca69b7a0ca01115425e>:0)
UnityEditor.AssetPostprocessingInternal.PostprocessSprites (UnityEngine.Texture2D tex, System.String pathName, UnityEngine.Sprite[] sprites) (at <5984c823338e4ca69b7a0ca01115425e>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
But there’s no bones at all in the texture I’m importing. TileGen came with a SpriteProcessor to handle the import process, so it doesn’t need to call the built-in one at all… but I’m not sure how to turn that off.
The offending line in SpritePostProcess.cs is this:
SpriteRect spriteRect = spriteDataProvider.GetSpriteRects().First(s => { return s.spriteID == guid; });
I tried adding a try/catch around it since I really don’t care about the error, yet of course it just re-imports the code when you re-open Unity.
Here’s a SS of the SpriteEditor. All of the sprites have Rects, Names, etc. I don’t know what it’s complaining about. I also get the error everytime I apply the settings in the Sprite Editor.
Any assistance would be very much appreciated!
