Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

SimpleAnimation doesn't play animation in release builds

Discussion in 'Animation' started by Laicasaane, Jun 6, 2018.

  1. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    21
    I'm using SimpleAnimation to make it be able for my logic code to control both legacy and mecanim animation clips. When the game starts, the SimpleAnimation will be created through the following procedure:
    1. Get all animation clips from either Animator or Animation component attached on the model.
    2. Instantiate these clips.
    3. If the clips were from an Animation component, set newClip.legacy = false.
    4. If the component is Animator, get out the Animator.avatar if there is any then instantiate it for later use.
    5. Call DestroyImmediate to destroy either the old Animator or Animation component.
    6. Add SimpleAnimation component to the model.
    7. Attach the avatar to the new Animator.
    8. Add all the animation clips to the SimpleAnimation component.
    9. Then my code would call SimpleAnimation.Play("clip name") or .Stop() at some specific time or conditions.
    In both Unity Editor and release builds, that procedure can create SimpleAnimation, add animation clips, get animation clip and state info correctly. In Unity Editor I could see the animation clips running. But they just don't run in release build (both legacy and mecanim)! There is no error, no warning, no message about what's going on. I don't know if that is because of me instantiate the clips at runtime or anything? Or I have misunderstood the usage of SimpleAnimation and use it wrongly?
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,552
    yes this is probably the reason why it doesn't work, there is no need to instantiate those clip because they are asset that are referenced, have you try to just use the clips as is?

    Also it not possible to convert a legacy clip to a mecanim clip at runtime, that would only work in the editor
     
    Laicasaane likes this.
  3. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    21
    Thanks for this clarification!