Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Access/Change loopTime in runtime

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

  1. lucasassislar

    lucasassislar

    Joined:
    Aug 26, 2013
    Posts:
    8
    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