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.
  2. Dismiss Notice

Does Playables API use C# Jobs and/or DOTS? (Out of Curiosity)

Discussion in 'Entity Component System' started by ModLunar, Jul 13, 2020.

  1. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    372
    I know in 2018, Unity released their experimental Animation C# Jobs with the Playables API,

    but I was wondering if the general Playables API (and my custom Playables) runs on the main thread, or takes advantage of the C# Job System?
     
  2. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    372
    Ah, just found this post with some cool insight.

    It seems like if you're NOT manually calling Evaluate(...) on the graph, it does use multithreading to its advantage where needed (it uses different parts of the PlayerLoop internally).

    I guess this answers my question for the most part!
     
  3. Justin_Larrabee

    Justin_Larrabee

    Joined:
    Apr 24, 2018
    Posts:
    106
    You can get concurrent execution of more than one animator if you put them all inside of one graph instance. It sucks, but it works.
     
  4. ModLunar

    ModLunar

    Joined:
    Oct 16, 2016
    Posts:
    372
    Hahaha, it sucks as in -- it's a pain to setup and keep working properly, but it's possible?
     
  5. Justin_Larrabee

    Justin_Larrabee

    Joined:
    Apr 24, 2018
    Posts:
    106
    Yea, sucks in the sense that you have to have a global graph instance and then jam every single animator into it, but yea it works and I've had no issues on iOS, macOS, or win64. I'm not sure how expensive it is to add/remove root nodes from a graph, so if you are doing that *alot* you will want to profile and see if it's a problem.
     
  6. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    But.. then don't they share all the triggers and variables too?

    Sounds like a nightmare.
     
  7. Justin_Larrabee

    Justin_Larrabee

    Joined:
    Apr 24, 2018
    Posts:
    106
    Well, using low-level playables API on an animator means no Mecanim. I also don't use animation events that Unity automatically fires (I null them out and do my own), so there could be some weirdness there.