Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Access/Change loopTime in runtime

Discussion in 'Animation' started by lucasassislar, Jul 27, 2020.

  1. lucasassislar


    Aug 26, 2013
    Hello, I'm currently developing a project called Unity LiveConnect, the intent is to serialize the entire Unity scene to a binary format and load it at runtime to make game testing on mobile devices faster (in my tests with small-ish projects I can hit TEST on my editor and have the game running on my device in less than 2 seconds).
    So far I've had some issues I could walk around, but Mecanim is being the greatest issue so far.
    AnimationUtility class cant be used in runtime, neither SerializedObject, and AnimationClipSettings are completely inacessible in runtime.

    So far everything's working, I've managed to create a scene, my models are serialized, a lot of things need custom serialization but everything's working at the moment, including the serialization of Mecanim controllers and animations, BUT the loopTime variable.

    Is there a way for me to change that loopTime variable in runtime? Even on a managed C++ plugin, it doesn't matter, just want to find a solution around this issue.

    Reflection does not work, as the settings is not in managed code (its not private either, its only native).

    TLDR: Need to change loopMode boolean inside AnimationClipSettings in runtime
    Last edited: Jul 28, 2020