Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Animation workflow/Animations directly from sprites

Discussion in 'Animation' started by Justa5, May 10, 2019.

  1. Justa5

    Justa5

    Joined:
    Jan 23, 2019
    Posts:
    15
    Hi all,

    I‘m looking for a good work flow to directly create animations from sprites (in the Animator), without the necessity to create a game object first.
    The reason for this is, that I have a pretty basic prefab for my NPCs holding an Animation Override Controller, which I only need to provide the specific animation clip for an NPC. The clips for an NPC are stored in a scriptable object (with all the other information I need for that NPC).
    So, what I basically do is to instantiate the prefab, inject the animation clips from the scriptable object and done.

    But at the moment it is a bit tedious to create/modify these animation clips, as this always needs a GameObject.
    To me the greatest option would be if I could just do it directly in my scriptable object, for example like this:
    1. Create new SO for new NPC
    2. Click on field for an animation
    3. Animator can be used as it does when a game object is selected.

    I guess that this won‘t be possible, but is there at least any other better way to do this, without having to create over and over a dummy gameobject again?

    Thanks for your help!
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,331
    I haven't worked with sprites much, but when I was working on examples for the upcoming update to my Animancer plugin I ended up making a bunch of functions for things like slicing textures into sprites and generating animations from them. You can grab the full script from here. It's not polished into a real workflow or anything, I just edit the script as necessary each time I need to use one of the functions. Hopefully you'll find it useful.
     
    Justa5 likes this.
  3. Justa5

    Justa5

    Joined:
    Jan 23, 2019
    Posts:
    15
    Hi SilentSin,

    thank you very much!
    So you are proposing implementing editor scripts to take care of all the issues? That might actually work and is a great idea! :)
    I will definitely check out your script in detail!
     
  4. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,331
    Yeah, I was thinking it would probably work well as an EditorWindow that shows different functions depending on the Selection.objects.