I found it takes a long time to load a timeline before first play. Even freeze the game for seconds on some android devices. Is there any way to preload a timeline playable asset?
Yes, you can use playableDirector.RebuildGraph(). It will do all the work of preparing the timeline for play (i.e. the CreatePlayable call in the profiler) without actually starting it.
I found this. But it still takes a long time to call a Evaluate() before first play (about 80ms on my Android). So I tried to call the Evaluate() to preload it, but it will present the first frame in timeline. I finally place a empty frame a the bigining of the timeline to prevent this. It is not elegant but works.
Here is the profile on my Android with only RebuildPlayable() for preloading. This happened when the timeline first play. It only contains a few infomations. And here is a profile in Editor on my PC, shows more call stacks.
That's interesting. If this is the first timeline that is being played, then it could be a Just-In-Time compile cost that is occurring. Looking at the profiles you sent, that seems to be the case. We've seen this before and it's compiling all the required timeline & playable C# code. The workaround is to play (or just evaluate()) a very simple timeline during startup. IL2CPP is better since the code is compiled, but, somewhat surprisingly, still has a significant hit.