Search Unity

Switch sprites to sprite sheet in animation clip automatically

Discussion in '2D' started by Stader, Sep 10, 2020.

  1. Stader

    Stader

    Joined:
    Jun 8, 2018
    Posts:
    15
    Good afternoon guys,

    I have a problem with performance, and one of the solutions is to turn the animation sprites into sprite sheets.

    There are around 150 animations and each one has 60 sprites. The idea is to put these 60 sprites together on a sprite sheet and then replace (manually it is a bit of a labor, so I want to avoid it).

    I noticed that the animator does not recognize the sprite sheet, even though they have the same name and the individual sprites are deleted.

    Do you know any solution?
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    @Stader

    "I noticed that the animator does not recognize the sprite sheet, even though they have the same name and the individual sprites are deleted."

    What do you mean by this, can you clarify? Animator doesn't work directly with sprites, it uses animation clips.

    Examples. If you have already created animation clips, and you go and delete / remove the sprites there won't be sprites in your animation clip. Also, if you happen to create some new texture sheet, from where you split new sprites, those either won't have any connection to any of your animation clips.

    So if you need to edit your animation clip(s) to use new sprites the solution is to replace the sprites from each frame AFAIK. You could possibly create some editor script if it is too much manual work.
     
  3. Stader

    Stader

    Joined:
    Jun 8, 2018
    Posts:
    15
    Yeah, it uses animation clips, I ended up expressing myself badly.

    In this case, I meant that he can't associate a sprite "run_00, run_01, run_02" present in the clip with a sprite sheet "run_" that has "run_00, run_01, run_02" inside.

    I did not consider altering via script. They even follow the same pattern. Is it possible to change the frames of a clip via script?

    The problem is the manual work is very high and I need to somehow decrease.
     
  4. Stader

    Stader

    Joined:
    Jun 8, 2018
    Posts:
    15