【Unity】UnityのTimelineが実機で再生されない件について

【Unity】UnityのTimelineが実機で再生されない件について

https://qiita.com/hide_gugen/items/7fee18be2c789144ed74

経緯

Editor上では普通に再生されていたのに、
ある日AssetBundle化してiPhoneで確認したら再生されない。
Xcodeで端末のログを見てみたらよくわからない文字が。

PlayableGraph being evaluated with no outputs. Playables will not be updated

なるほどねー。分からん。

環境

  • Unity 2017.2.0p4
  • MacOS 10.13.4

私はTimeline初心者

Timeline最近触ったばかりでよく分からなかったし、
PlayableDirecterで再生すれば良いのだろうと
PlayableDirecter.Play(PlayableAsset);で再生していた。

TimeLinePlayer.cs

/* 省略 */

public PlayableDirector _director;
public PlayableAsset _situation;

/* 省略 */

public void PlayTimeLine ()
{
  // タイムライン再生
  _director.Play(_situation);
}

これでだいたいは動くのにたまーに実機で動かなくなる。不思議。

別の書き方で動いた…?

ちょこっと書き換えて実機で確認したら動いた。
よく分からない処理をしているからなんだか不安…

詳しい人教えてー

TimeLinePlayer.cs

/* 省略 */

public PlayableDirector _director;
public PlayableAsset _situation;

/* 省略 */

public void PlayTimeLine ()
{
  // Directorにセット
  _director.playableAsset = _situation;
  // よく分からんやつ(Graphを評価するみたいなの)
  _director.Evaluate();
  // タイムライン再生
  _director.playableGraph.Play();
}

_director.Evaluate();の部分が何をしているのか…
書かないで実行したらEditor上でもエラーで動かなかったから必要なんだろう。

Evaluates the currently playing Playable at the current time.

公式にはこう書いてあるが英語が読めないので何となく使うマンです。

動作はまだ不安定

AssetBundleにすると何かしらの処理が間に合わないのか?
そもそも再生できる方法が2つあるのって紛らわしい。
正しい再生方法があるはずだが情報が足りない…

もっとTimelineを使う人が増えてくれると良いなぁ。
詳しい人はホント教えてください…

※追記:2018/06/19

また再発されたのでIsValidで確認してから再生するようにした。

TimeLinePlayer.cs

/* 省略 */

public PlayableDirector _director;
public PlayableAsset _situation;

/* 省略 */

public void PlayTimeLine ()
{
  // タイムライン再生
  StartCoroutine(TimelinePlay());
}

IEnumerator TimelinePlay ()
{
  // タイムラインをセット
  _director.playableAsset = _situation;
  // よくわからんやつ
  _director.Evaluate();
  // グラフが有効か
  while(!_director.playableGraph.IsValid())
  {
    yield return null;
  }
  // タイムライン再生
  _director.playableGraph.Play();
}

※追記:2018/06/20

また再発…

もう直らないんじゃないかレベルで動かない。
もう少し探ってみます…

※追記2018/06/21

公式フォーラムで似たような内容があった。
AssetBundle化したシーンで動作しないもの。

They work fine in editor and also on Android devices but if we try to run a scene bundle (either built with asset bundle browser or with BuildPipeline.BuildStremedSceneAssetBundle, makes no difference) on any iOS device we encounter this error that originates from any PlayeableDirector in the scene.

強引な解決策だが動いたという情報もあり、
空のシーンにCubeを作ってタイムラインの設定して、カメラ全部決してビルドの最初に置いたら良い模様。

I had the exact same problem, here is my roundabout solution:
Make an empty scene were you animate a cube with the Timeline and delete all cameras from the scene.
Make this the first scene in your build and write a script were the next scene is loaded in the Awake function.

Now the AssetBundles with Timeline should work.
Good luck guys.

これで動くのなら、ビルド時にTimeline関係が剥がれている?
PlayerSettings > Strip Engine Codeのチェックを外していても剥がれるのかな。

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值