Search Unity

Can't animate SpriteShape control points?

Discussion in 'Animation' started by TimBur, Jul 12, 2021.

  1. TimBur

    TimBur

    Joined:
    Jan 17, 2013
    Posts:
    35
    Hello folks,

    I'd like to create some animations that reshape a SpriteShape spline based on game state. I've tried a couple options, but none seem to work. As best I can tell, the SpriteShape control nodes are hidden from Animator/Animation components in ways that make it impossible to animate the shape of a SpriteShape using Unity's Mecanim animation system.

    This makes me sad. Am I missing something? Is there a way to do this?

    Using Unity 2020.3.7 and SpriteShape 5.1.3

    Process:
    1. Select SpriteShape GameObject in Hierarchy.
    2. Open Animation window, select desired animation from dropdown, and press record.
    3. In Inspector for SpriteShapeController, click Edit Spline. Edit the spline by moving control points and adjusting tangents.
    4. Turn off record button.
    5. Find that nothing has been recorded: no SpriteShape-related properties in the Animation window. And when I click the Play button in the Animator window, the SpriteShape doesn't change.
    Alternate process:
    1. Select SpriteShape GameObject in Hierarchy.
    2. Open Animation window, select desired animation from dropdown.
    3. In Animation window, click Add Property. Browse options.
    4. Find that there are no control-point-related properties in SpriteShapeRenderer or SpriteShapeController
    Help appreciated ...
     
  2. therobby3

    therobby3

    Joined:
    Jan 30, 2019
    Posts:
    131
    I've dug into this same problem and wasn't able to completely find a solution. You can do some animation yourself via code by access the control points and moving them around with script. But that probably won't fit what you need them for.

    I needed to do the same thing, and after digging around for a solution I think that the problem partially extends from the fact that the animation timeline does not save array values. The SpriteShapeController stores each control point and such in arrays, so I believe that is at least part of the reason it does not work.
     
  3. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    644
    Please take a look a this excellent video for one way to Animate points :
     
    MADROYAL likes this.