Search Unity

Do or will these functions work at runtime with Mecanim or Playables?

Discussion in 'Animation' started by nsfnotthrowingaway, Nov 13, 2017.

  1. nsfnotthrowingaway

    nsfnotthrowingaway

    Joined:
    Feb 18, 2016
    Posts:
    45
    I thought I saw a changelog or blog post that said that you could do this now, but I can't find it now, and the documentation (2017.3b) still says:
    Note: SetCurve will only work at runtime for legacy animation clips. For non-legacy AnimationClips it is an editor-only function.

    If not and I want to have completely procedurally generated animations at runtime:
    create animationClips
    add animationCurves
    add or change keyframes to those curves
    blend and use these completed animations in an animator or playable to blend

    or something equivalent to those steps in terms of flexibility.
    Is that possible yet?

    And lastly, is there any way to add parameters and conditions at runtime?
     
    Last edited: Nov 14, 2017
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,666
    The documentation is right.
    If you want to create animation clip at runtime you need to use the Animation component.

    Nope, a controller can only be changed in the editor, if you need flexibility at runtime you're choice are either the Animation component or the playables.
     
    nsfnotthrowingaway likes this.
  3. nsfnotthrowingaway

    nsfnotthrowingaway

    Joined:
    Feb 18, 2016
    Posts:
    45
    Thanks for the info. Ok, so last question - Before I roll my own, I just want to verify, there are no equivalents to transitions and state machines for Playables at the moment or coming in the next version, correct?
     
  4. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,666
    Short answer is no but ...
    Transitions and statemachine are a concept used in a controller, and the controller under the hood is implemented with playables.

    What is a transition? simply a blend between animation clips, so you can roll you own transition system with a AnimationMixerPlayable connected to two AnimationClipPlayable.
    Of course you also need to take care of the timing: when the blending occur and under which condition. This is what the statemachine does for you.

    So the long answer is you have all the tools that the controller use to roll you're own version.
     
    nsfnotthrowingaway likes this.
  5. deus0

    deus0

    Joined:
    May 12, 2015
    Posts:
    18
    So basically the workaround to runtime animationclips (non legacy), is to use legacy animtionclips with the playable system? (assuming animation component would require alot more work for transitions?)
     
  6. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,666
    @deus0 unfortunately, legacy animation clip doesn't work with playable system
     
unityunity