Unity3D中 TimeLine打成 AssetBundle 包的BUG

(1)

Unity3D中 TimeLine打成AB包的BUG

https://www.jianshu.com/p/a63141ea5fec

当把包含TimeLine的的预设打成AssetBundle时,运行后会有概率触发找不到Playable Director的脚本,然后TimeLine播放失败.IOS,Android 都会触发.

 

Unity3D中 TimeLine打成 AssetBundle 包的BUG

image.png

经过多方尝试后,发现只要打包前将包含TimeLine的预设打开一次,再次打包则能修复TimeLine播放失败的BUG.(老中医解决方案).
笔者版本 Unity 2019.1.10f1



作者:_ArayA_
链接:https://www.jianshu.com/p/a63141ea5fec
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

(2)

脚本 Unity2017中TimeLine中有PlayableAsset可以通过Assetbundle加载吗?

http://www.manew.com/thread-135019-1-1.html

加载带有PlaybleTrack的Timeline之后一直报错:Assertion failed: Assertion failed on expression: 'pred(*previous, *i)',并且,PlatableTrack中上关联的物体都错乱了?

我解决这个问题了,把timeline要用到的GameObject做成一个预设,加载后动态添加PlayableDirector,然后依次给每个clip赋值就行了,timeline能正常跑,也不会报错

(3)

iOS Timeline / PlayableDirector not working in AssetBundles

https://forum.unity.com/threads/ios-timeline-playabledirector-not-working-in-assetbundles.515426/

Hi,

we have a problem on iOS with AssetBundles, that include Timeline Animations. The AssetBundle is working, but the Animation is not playing. The errors are:

PlayableAsset returned a null Playable on Instantiate
PlayableGraph being evaluated with no outputs. Playables will not be updated

On Android and in Editor Playmode all is working well.

The Problem seems to be a duplicate to

https://issuetracker.unity3d.com/is...ading-with-unitywebrequest-dot-getassetbundle

but this issue seems to be closed as resolved?

But with Unity 2017.3.0f3 it is still existing.

Reproduced on iPad 4 iOS 10.3.3
Reproduced on iPhone 5s iOS 10.2.1
Used Unity 2017.3.0f3

IL2CPP Code Stripping was on and off. Both testet, bug everytime. The Timeline was known and exported to the App. Because DummyTimeLines were included for testing.

AssetBundle was loaded by WWW, AssetBundle.Load and File.ReadAllBytes and get the Bundle from the bytes.

There seems to be no workaround. The only way is, to rework all Timeline Animations to "Standard AnimationController" Animations and use the old way. With a lot of animations with keys to audio this is not the desired way and Timeline Support would be really great!

Anyone else having this problem? Is there still a bugreport running? I found only the one above.

Greetings,

Martin

 

There is a workaround posted in another thread:

https://forum.unity.com/threads/timelines-do-not-work-in-scene-bundles-on-ios.496157/

Look at the post of
ZeFirestarter from 13.2.2018. The workaround worked for us.

 

Just wanted to post for the benefit of others.
I recently ran into the same issue and wanted to post my work around.

It's rather simple, but unfortunate to have to do it.

Just add a PlayableDirector component into a scene that is included in your build. In my case I chose our boot scene.
Then create a Timeline asset that won't be used. I named it emptyTimeline for clarity.
Assign this to your PlayableDirector and the problem should be resolved.

It's worth noting you will also get this issue on Android if using IL2CPP builds or with Mono builds using a stripping level other than disabled.

 

The alternative is to create "link.xml" file which includes classes from "UnityEngine.Playables" namespace. This also solves the issue.

Didn't have a great deal of luck with link.xml, it appeared to work at first then stopped.
Simpler solution even than including a timeline in a non-bundled scene is simply to create an empty .playable file in Resources/. It'll only be about 200 bytes, that seems to prevent stripping.
e.g. In any scene add a Timeline, save the playable to resources, delete the timeline.

 

https://issuetracker.unity3d.com/is...ctor-dot-playable-when-used-in-an-assetbundle
 

Code (JavaScript):

  1.     <assembly fullname="UnityEngine.Timeline">

  2.         <namespace fullname="UnityEngine.Timeline" preserve="all"/>

  3.     </assembly>