Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

PowerSprite Animator - Edit your sprite animations in style

Discussion in 'Assets and Asset Store' started by PowerhoofDave, Sep 29, 2016.

  1. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    PowerSprite Animator is a cracking fine tool for editing your sprite animations!


    The goal of this tool is to make adding and editing sprite animations as quick and painless as possible. If you're working on a project with animated sprites, this tool is for you! The editor provides a simple intuitive interface allowing you do add/remove/reorder frames, edit timing and events, and get the feel of your animation just right.

    With PowerSprite Animator, there's no need to set up animation states and a GameObject just to edit a sprite animation. And if you prefer (like I do) you can even avoid using mechanim animation states altogether by playing animations from your scripts! Check out this video tutorial to see that in action.

    Let me know in this thread if you have any questions, bugs to report, or feature requests!

     
    Last edited: Jun 27, 2019
  2. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    104
    Hi,
    this look very good!
    does it work with my already exist animation files?
    what about performance?

    thanks,

    haim
     
  3. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hi Haim,
    Yes it will work with your existing unity animation files (assuming they are a animating a sprite). Support for animating GUI images is coming soon too.

    In game performance will be exactly the same as before since it still uses unity's animation system, just provides a nicer editor.

    Hope that helps!
     
    rakkarage and zyzyx like this.
  4. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    104
    so how "avoid using mechanim animation states altogether" thing works?
    any code sample?
     
  5. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Ah yes, there's a component included that has functions to play animations, taking the animation as a parameter. Internally that works by using unity's animation override controller, manually overriding a single state when you play an animation.

    Here's a video with an example of how to use it-


    edit:
    And here's a couple of code snippets
    - "Effect" component that plays an animation and destroys itself: http://pastebin.com/5z8qAMqU
    - "Runner" component, example of simple character with run and idle animation (from the video): http://pastebin.com/rq5NZRwJ
     
    Last edited: Oct 12, 2016
  6. haim96

    haim96

    Joined:
    May 24, 2013
    Posts:
    104
    OK, last question, can i animate other properties like position or rotation of sprites with this?

    thanks!
     
  7. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Nah, you'd still use the built in unity animation tool when you want to do that. I'd like to add some basic transform animation in the future, but can't guarantee it at this point.
     
  8. whoozi

    whoozi

    Joined:
    Oct 10, 2013
    Posts:
    4
    Would it be possible to add support for nodes/sockets? Just for the ability to mark a location and rotation relative to the sprite in the animator per frame. For example, I could get the location and rotation of a node/socket called "Weapon" from the animator at run-time to position my character's weapon at said node/socket.

    Thanks.
     
  9. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Yes, I have that in the works. Used it for a few game jams recently and it seems to work (eg: basketball + weapon attachments for this: http://i.imgur.com/YnyiLxW.gif), but wanted to test it more thoroughly before putting updating the asset. If you email me (dave at powerhoof.com) I can send you a version to try out and give me feedback :)
     
  10. tomtominc

    tomtominc

    Joined:
    Nov 7, 2013
    Posts:
    21
  11. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Yes, if you're using unity's spritesheets it works with them.
     
  12. sheffer

    sheffer

    Joined:
    Aug 22, 2013
    Posts:
    2
    Just got this and followed along with this video to learn how to change from script.


    Looks very good!

    Do you have any idea on how to set a clip in the script (not via public field and set that in the editor).

    I basically want something similar to this (semi-pseudo code)

    public AnimationClip animIdle = null;
    private SpriteAnim anim = null;

    void Awake(){
    animIdle= SetClip("SomeAnimationThatExistInTheProject");
    }

    void Start() {
    anim = GetComponent<SpriteAnim>();
    anim.Play(animIdle);
    }

    Possible?
     
  13. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Yeah, the easiest way to do that is to use unity's Resources system.
    Basically you put any animations you want to include in your game under a directory named "Resources". You can have multiple of those directories in your project, and you can also have subdirectories under them, so you can organise the folders how you want as long as they're under one called "Resources".

    So if for example you have your Run anim in a folder with this path: "Resources/Animations/Idle.anim"
    Then to set the animation you do:

    Code (CSharp):
    1. animIdle = Resources.Load<AnimationClip>("Animations/Idle");
     
  14. sheffer

    sheffer

    Joined:
    Aug 22, 2013
    Posts:
    2
    Thanks Dave, got it working now! It is really a great pleasure to not have to deal with the Animation Controllers and unitys weird system of having to have stuff in the scene to create animations, it is really confusing.

    Both the editor extension and the addition to scripting (the Play, check whats Playing etc) is very useful.
     
  15. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    454
    Hey, picked up PowerSprite animator and it's really nice. Great work on the timeline editor. Do you think it'd be possible to get it working with sprite sheets that have been packed using polygon packing?
     
  16. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,188
    Would be cool if you'd include TexturePacker-Spritesheet Support, too! :)
     
  17. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    454
    Ah yes, should have mentioned, I'm using TexturePacker too!
     
  18. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
  19. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    454
    PowerhoofDave likes this.
  20. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Sweet I'll take a look, got a game to launch in a few days so might take a while to get to it! In the meantime I've just submitted a major update with attachment nodes to the store so you'll see that soon :)
     
    flashframe likes this.
  21. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    454
    Nice one. Good luck with the launch :)
     
  22. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,188
    @PowerhoofDave Nice! I'm quite interested in this asset. Just some further questions:

    - there a public API available?
    - what can I do through code? From your video I can play an animation and check if it's playing or not. Can I do more? Like playing the animation from a specific frame, change the speed etc. ?
     
  23. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Here's the doc which details most of the functions: http://powerhoof.com/public/powerspriteanimator/PowerSpriteAnimator-Manual.pdf Hopefully has what you're after!

    As of today's update, yes, you can set the playback speed, pause/resume anims and set the anim time (either seconds, or normalised time) to start an animation from a specific place!
     
    BTStone likes this.
  24. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    PowerSprite Animator 1.2 Update!

    PowerSpriteNodes-Smaller.gif
    Changes:
    • Added animation nodes functionality: Set position points in your anims to attach stuff to!
    • Pause/Resume anims in SpriteAnim Component
    • Set anim playback speed and time in SpriteAnim Component
    • Fixes to support Unity 5.6
     
  25. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,188
    Nice stuff. Thanks for the docs. Will probably pick this up for our next project.
    Could you just elaborate a bit where you'll heading with this asset? Meaning: what's the roadmap? :)
     
  26. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    All the features I'd planned are in now, so I'll wait and see what feature requests come in and what enhancements we discover would be useful from our own game dev.
     
    BTStone likes this.
  27. dukester

    dukester

    Joined:
    Nov 7, 2012
    Posts:
    14
    I just bought your plugin feeling ecstatic about not having to deal with stupid Unity Sprite Animator interface, but when I imported my first frame of animation it picked up the whole rectangle of the sprite from the atlas which made it also pick up parts of the neighbouring sprites since I packed the atlas with TexturePacker using polygon mode.
    Why???
    Coming here, I saw that you don't support TexturePacker made atlases. Also, in the frame list it only shows the name of the atlas for each frame, not the individual names of the sprites.
    Dude, it would be great if you implemented support for TP. It's lightyears ahead of Unity's joke of a packer, both in terms of available options as well as algorithm intelligence.
    For example, the first atlas I used to try your plugin is 2048x2048 and consists of 56 sprites.
    When I packed those same sprites using Unity's packer, it made me two atlases: 2048x2048 + 1024x2048!!!
    Please implement this feature, I would love to use your plugin but I can't until you do that.
    Thanks.
     
  28. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hey duketester, I'll be starting to use TexturePacker for our own projects, so definitely keen to add support. Just a matter of finding time at the moment!
     
  29. dukester

    dukester

    Joined:
    Nov 7, 2012
    Posts:
    14
    Cool.
    Just took a closer look and since you're setting the 'Sprite' property in Unity Animation, the thing actually works, it's just the preview and the frames list that are f-ed up.
    I corrected the frames list myself (just replace 'Texture2D' with 'Sprite' in SpriteAnimatorInfoPanel.cs->LayoutFrameListFrame()), but couldn't fix the preview since I couldn't find a way to display a Sprite properly in an Editor window. Everybody suggests using GUI.DrawTextureWithTexCoords(), which is basically what you're using, but that doesn't work with tightly packed sprites using polygon mesh. There seems to be no function to display a sprite in the Editor (when I say 'a sprite' I mean any type of sprite that is supported by the engine, not just one type).
    Shame on UT.
     
  30. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,188
    Hey @PowerhoofDave

    do we have the option to animate while ignoring time scale? If not: feature request! :)
     
  31. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hmm, I'm not sure I understand exactly what you mean. But you can increase the sample rate if you need to do more fine adjustments. I usually wack it up to 60 or 100, any higher and it gets more awkward keeping consistent timing on frames for more complicated anims.

    I did get a feature request to be able to set a default sample rate which I'd like to add, since that's something I'd find useful too.
     
    BTStone likes this.
  32. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,188
    Ah, you misunderstood me, no problem.
    What I mean is: I assume you're using some sort of Time-Variable to play the animation. If we set the Time.timescale to 0 the animation would "stop", right? But what if I'd like to play animations while the timescale is set to 0, like in the UI :)
    As of now Unity has a time-variable for these purposes, Time.unscaledDeltaTime (https://docs.unity3d.com/ScriptReference/Time-unscaledDeltaTime.html) which doesn't take the timescale in consideration
     
  33. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Ahhh ok, it's still the unity animation system that's playing the animations, PowerSprite just gives an editor and component with a nice interface for playing them.

    But that does mean that if there's another asset or code snippets for handling pausing / timing for unity animation it'll work the same.

    The way I handle pausing is to loop through all game objects in the scene and disable all their components (except render ones) if they're not in the UI layer. Then to unpause- enable them all again.

    Hope that helps!
     
    pry_bar and BTStone like this.
  34. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,188
    Ah I see, thanks for the explanation.

    Uh, that sounds like it might have an impact on performance, at least when the scene is big. Did you do some optimisations on this or do you plan any?
     
  35. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Performance shouldn't be an issue since I use it when pausing the game anyway you can't tell the difference if you drop a few frames :)

    It seemed to be the way others solved the problem at the time but that was a few years ago. There might be a better way now since it's such a fundamental thing to be able to do in a game engine, but I think that's still the way people do it. I was surprised unity didn't have a proper system for pausing like other engines do (eg scene stack). There's lots of seemingly obviously useful things missing in unity though I guess (hence PowerSprite animator) ;)
     
  36. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    FYI The new update just went live, adding support for TexturePacker and polygonal sprites!
     
    flashframe likes this.
  37. Oab

    Oab

    Joined:
    Aug 16, 2012
    Posts:
    17
    I adjust sprite anchor in sprite editor and SpriteAnimNodes's GetPosition function return incorrect position.
    I think It still use anchor at the center. Do you have any solution for this issue?

    Thanks
     
  38. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hi Oab, have you updated to v1.3? It just came out today. I believe that issue was fixed in this update, but let me know if it's not (or if it was working and I just broke it!) and I'll fix it asap.
     
  39. Angry-Bugs

    Angry-Bugs

    Joined:
    Jun 28, 2016
    Posts:
    1
    Hi Dave, first your editor is really useful! It's easy to use and helped me a lot.
    Now I have a little problem: the nodes seems to be displaced on each frame when using TexturePacker to export the sheet, with the option "Trim mode" in "Crop, keep position"; that will remove transparent pixels around each sprite but keeping the original position to use it in the animation (I think you already know that xD), but in the editor it ignores that original position and shows each frame without transparency, making it innacurate when setting nodes. Is this what's happening or I'm doing something wrong?, I can adjust the position on each frame but sometimes it could be tiresome.
    Thanks!
     
  40. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hmm, thanks I'll test that. Might be an issue with the sprite pivot offset calculation.
     
    Last edited: Jun 16, 2017
  41. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    I've submitted an update with better support for sprite pivots (and a couple of other things). @Angry-Bugs I'll DM a build to you since it takes a little while for Updates to be approved.
     
  42. Oab

    Oab

    Joined:
    Aug 16, 2012
    Posts:
    17
    Thanks, It's fixed in 1.3. :)
     
  43. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Update 1.4 just went up! This update improves support when using Texture packer with pivots, and adds some default settings when creating new animations.

    NOTE: If you have non-centered sprite pivots previously, the positions will have changed.
    You can use the old positions by ticking the "Ignore Pivot" box in editor settings of the PowerSprite editor, and by passing in "True" when you call GetPosition. Eg. GetPosition(0, true);
     
  44. Jack-Mariani

    Jack-Mariani

    Joined:
    Jul 12, 2013
    Posts:
    10
    Hi and thank you very much for the asset. It greatly improves the 2d workflow.
    Is it possible to set the length of an animation (AnimationClip) via code?

    How can I achieve that by using only the AnimationClip?
     
  45. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    At runtime you can set the playback speed when you play the animation which has the same effect. To do that, set the "Speed" property on the SpriteAnim Component. eg. GetComponent<SpriteAnim>().Speed = 2; will halve the length of the animation that's playing.

    Hope that helps!
     
  46. Oab

    Oab

    Joined:
    Aug 16, 2012
    Posts:
    17
    Hi, Any update for Unity 2017?

    I have issue about sprite disappear from timeline and preview window. It happen after I hit play button. I need to re-open unity to see again.

    I put sprites from 2 files into 1 animation. I setup anchor different in each files.
    Animation still work properly.

    I captured screen how I reproduce.
    http://gph.is/2um0zdT
     
  47. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hi Oab, yes that's an issue with 2017, I'll try and have a fix asap!
     
  48. TomMG

    TomMG

    Joined:
    Jun 1, 2017
    Posts:
    2
    Wondering if there's any update on ETA for a fix, as we're experiencing the same glitch. Absolutely love PowerSprite Animator and we're using it in our current project, so the bug is holding us back on shifting the project over to 2017.1. Thanks!
     
  49. PowerhoofDave

    PowerhoofDave

    Joined:
    Jun 26, 2015
    Posts:
    69
    Hi TomMG, I've submitted a version with the fix to unity, should be available soon. DM me if you want and I can hook you up with a build in the meantime.
     
  50. PixelEnvision

    PixelEnvision

    Joined:
    Feb 7, 2012
    Posts:
    501
    @PowerhoofDave

    Thanks for the great asset, it really makes things easier. :)

    IsPlaying() seems to return false for a looped clip after first run. Is this intentional or a bug?
     
unityunity