#I feel like I want to have something
1 messages · Page 1 of 1 (latest)
Not entirely sure, depends how the sprite animations are authored
If each index of a sprite library matches to the same animation frame for every part and every item, then you do need to animate only one property that your Notifier would pass to every Resolver in a loop
If index 4 is "facing front" for every optional part, and 5 is "facing back" for example, then you know if you set every Resolver to index 4 it'll work out
No need for the Animator to set every single Resolver in the hierarchy to index 4
The choice of hat / lack of hat does not sound like a responsibility for the Animator
I think your script would either toggle the gameobject, or maybe more preferably swap the headwear sprite's Library to "no hat" library, or a library corresponding to the hat
No need to worry about toggling if you can hide pieces just by swapping to an empty Library
In this scenario the Notifier component is still taking orders from the Animator to set all parts' including the hat's sprite index
Which if the player is looking back and forth would be going between those indices 4 and 5
Even if the Library has swapped to a nonexistent hat
Now this is assuming all the items will have exactly matching "sprite sheets" or Libraries
But that's not always the case
If individual parts must pick different sprite indices from their sheet / Library, then the Animator must be controlling the Resolvers directly, or have the option to do so through the Notifier
I know some games, like Starbound, where every accessory has every frame of animation on its sprite sheet, so cycling the frames is extremely simple from code
But some games may give some items like weapons only a few unique frames, which are re-used by the animator based on what's the most fitting frame, possibly with an offset
In this case your Animator can also apply offsets to sprites/ "bones" if required by the clip, even if that's getting closer to skeletal animation
But to answer your question yes, Unity is missing a sprite sheet animation workflow
Always did because its sprites only have an unique ID, there's no concept of a "sheet"
But Sprite Library meets that need halfway
Thanks for the answer.
So now what I think I need to do is:
- Create a sprite library for each animation and frame. I already have that.
- Create all the sprite library variants for all the things I'd like to swap: body parts, cloths, etc.
- Create a
SpriteResolverNotifiercomponent which will change frames on the sprite resolvers.
The thing is that when I change things in sprite resolver, animator addresses them by the sprite hash. Is this sprite hash going to be the same in all animation library variants?
So that I can also reuse that in my SpriteResolverNotifier: make my SpriteResolverNotifier also use sprite library and let the user pick the sprites by animation and frame number, and then set that property, and then once the property is changed, set it on all the resolvers?
You'll have libraries for each part variant which'll contain animation frames used by that part
Not a Library for "each animation" in the sense of animation clips or states
Could show a screenshot of it when you have one or two ready to confirm we're talking about the same thing
We're avoiding having to use sprite hashes / explicit sprite references entirely
I believe you Get/Set Resolvers using strings, so you want every animation index in each Library to have the same name for them to match
Since it represents animation frame, I think you can do integers as you would traditionally
But the frames can have unique names as well, as long as they're global
The previously created animation clips have to be remade / edited to set the Resolver property in your Notifier component