Antoshidza / NSprites-Foundation

Basic assets for working with NSprites package
MIT License
65 stars 17 forks source link

Feature Request: Improve Sprite artwork workflow 2 #22

Open SamuelAsherRivello opened 3 months ago

SamuelAsherRivello commented 3 months ago

I have a Unity 6 project with this setup...

... and I pulled ...

... into my project with success. Great work!

PROBLEM:

I notice that the length of FrameDurations on the SpriteAnimation object must match the number of sprites resulting from the FrameCount values of the SpriteAnimation object.

This is manageable to manually keep in sync.

WORKAROUND:

One solution would be to support the current workflow AND support having exactly one value (and perhaps a boolean of 'UseSameDuration=true') for the FrameDurations on the SpriteAnimation object. The system would reuse that one value across all frames, which by the way is probably the primary use case.

RESULTING CONSOLE LOG

System.IndexOutOfRangeException: Index 6 is out of range Length 6
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffd7665e45e (Unity) burst_abort
0x00007ffe4049cf8e (431ef944cf951df94a332f6244d0509) burst_Abort_Trampoline
0x00007ffe40496850 (431ef944cf951df94a332f6244d0509) NSprites.SpriteUVAnimationSystem.AnimationJob.Execute (at D:/Documents/Projects/VC/Unity/rmc-dots-jam-3/Unity/Library/PackageCache/com.unity.burst/.Runtime/Library/PackageCache/com.tonymax.nsprites.foundation/Animation/Systems/SpriteUVAnimationSystem.cs:54)
0x00007ffe40496c1e (431ef944cf951df94a332f6244d0509) NSprites.SpriteUVAnimationSystem.AnimationJob.Execute
0x00007ffe404981f5 (431ef944cf951df94a332f6244d0509) Unity.Entities.JobChunkExtensions.JobChunkProducer`1<NSprites.SpriteUVAnimationSystem.AnimationJob>.ExecuteInternal (at D:/Documents/Projects/VC/Unity/rmc-dots-jam-3/Unity/Library/PackageCache/com.unity.burst/.Runtime/Library/PackageCache/com.unity.entities/Unity.Entities/IJobChunk.cs:399)
0x00007ffe4049615d (431ef944cf951df94a332f6244d0509) 0d096840f301b26d659e152fbeb56796
0x00007ffd7665ab35 (Unity) ExecuteJob
0x00007ffd7665ae5e (Unity) ExecuteJobCopyData
0x00007ffd766580b6 (Unity) ujob_execute_job
0x00007ffd7665728f (Unity) lane_guts
0x00007ffd76659e84 (Unity) worker_thread_routine
0x00007ffd7684d73d (Unity) Thread::RunThreadWrapper
0x00007ffe9a41257d (KERNEL32) BaseThreadInitThunk
0x00007ffe9b60aa48 (ntdll) RtlUserThreadStart
Antoshidza commented 3 months ago

In my opinion such bool things looks ugly without better inspector which should hide array if UseSameDuration == true and show single input field instead, still under the hood having same array of durations as long as those SOs are just authoring in-editor only data.

As I mentioned in other issues I've implemented NSprites-Foundation as minimal example of how NSprites could be used. Though I was thinking about to do what you suggest to do numerous of times, so I will do this eventually, after more important changes I have plans to do.