Search Unity

Preload Animation

Discussion in 'Animation' started by danBuonocore, Jul 23, 2016.

  1. danBuonocore

    danBuonocore

    Joined:
    Aug 26, 2015
    Posts:
    12
    The first time each of my animations are played, they hiccup quite a bit. I tried placing the animation files in the Preloaded Assets array in Player Settings > Other Settings, but it didn't seem to change anything. My guess is I should play all the animations out of sight in the background while the game is loading up, but that that could get pretty hairy as a lot of the animations have events in them, and I'd rather not have to trace through all the code of a near-finished product to set flags for that. Is there an easier way to do this? Thanks!
     
    prabhukaran and XCO like this.
  2. Romariuja

    Romariuja

    Joined:
    Jan 12, 2017
    Posts:
    1
    I'm having same problem. My animations (imported from xml files) are delayed only the first time that are played.
    Does anyone knows how to solve this?
     
    XCO likes this.
  3. PlauineB

    PlauineB

    Joined:
    Dec 13, 2018
    Posts:
    1
    Same issue here. And the hiccup you are mentioning happens to me every time I disable and enable a Game object. Unity kind of re-loads the animation each time (from what I understand).
    Does anyone have an idea ?
     
  4. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    130
    did anyone find any solution?
     
  5. albondgames

    albondgames

    Joined:
    Jul 19, 2018
    Posts:
    8
    Same problem here... have you had any success?
     
  6. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    130
    The only solution I found, is the load the animation on an object with 100% transperant material so it doesnt appear on camera but it load in the first frame directly , thats the only way I could preload the animation without lagging in the mid of the game
     
  7. albondgames

    albondgames

    Joined:
    Jul 19, 2018
    Posts:
    8
    How do you load the animation? Load as in just playing it on an invisible object?
     
  8. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    130
    Yes exactly, thats the only way it never freeze the engine in mid game
     
  9. prabhukaran

    prabhukaran

    Joined:
    May 5, 2019
    Posts:
    17
    In my case the lag was caused by Mono build in player settings. IL2CPP build fixed it.