PlayableGraph は、ゲームオブジェクトか コンポーネント にバインドした一群の playable の出力を定義します。さらに、PlayableGraph は一群の playable とそれらの関係を定義します。図 1 はその例です。
PlayableGraph は playable とその出力を操作します。PlayableGraph を使って playable を作成、接続、破棄できます。
図 1 で、PlayableGraph を表示するときに、名前をより短くするために “Playable” という語はグラフのノードから除かれます。例えば、“AnimationClipPlayable” という名は “AnimationClip” と表示されます。
playable は IPlayable インターフェースを実装する C# 構造体です。他の playable との関係を定義するために使用されます。同様に、playable の出力は IPlayableOutput を実装する C# 構造体で、PlayableGraph の出力を定義するのに使用されます。
図 2 はもっとも一般的な主要な Playable 型です。図 3 は主要な PlayableOutput の型を示しています。
Playable と Playable 出力の主要な型は、メモリーのガベージコレクション への割り当てを避けるために C# 構造体として実装されます。
“Playable” はすべての playable の基底型です。つまり、常に暗示的に playable を “Playable” にキャストできます。その逆はできません。もし “Playable” が明示的に互換性のない型にキャストされると例外が投げられます。さらに、“Playable” は、 playable で実行するすべての基本メソッドを定義します。型特有のメソッドにアクセスするには、plyable を適切な型にキャストする必要があります。
同じことが “PlayableOutput” にも言えます。“PlayableOutput” はすべての playable の出力の基底型で、基本メソッドを定義します。
ノート: Playable
と PlayableOutput
では、外からアクセス可能なメソッドがあまり多くありません。その代わり、‘PlayableExtensions’ と ‘PlayableOutputExtensions’ 静的クラスが拡張メソッドを提供します。
すべての非抽象の Playable には、対応する型の playable を作成する静的メソッド Create()
があります。 ‘Create()’ メソッドは常に PlayableGraph を最初のパラメーターとして取ります。そして、グラフは新規に作成された playable を所有します。playable の型によっては、追加のパラメーターが必要な場合があります。非抽象の PlayableOutput もまた、外からのアクセス可能な Create()
メソッドを持ちます。
有効な PlayableOutput は Playable にリンクされていることが必要です。PlayableOutput が Playable にリンクされていない場合、PlayableOutput は何も行いません。PlayableOutput を Playable にリンクするには PlayableOutput.SetSourcePlayable()
メソッドを使用します。リンクした Playable は、その特定の Playable の出力にとって Playable ツリーのルートのような働きをします。
2 つの playable を接続するには、PlayableGraph.Connect()
メソッドを使用します。playable の中には入力できないものもあります。
PlayableGraph.Create()
静的メソッドを使用して、PlayableGraph を作成します。
PlayableGraph.Play()
メソッドを使用して、PlayableGraph を再生します。
PlayableGraph.Stop()
メソッドを使用して、PlayableGraph の再生を停止します。
PlayableGraph.Evaluate()
メソッドを使用して、PlayableGraph の特定の時刻の状態を評価します。
PlayableGraph.Destroy()
メソッドを使用して、PlayableGraph を手動で破棄します。このメソッドは、PlayableGraph で作成したすべての playable と playable の出力を自動的に破棄します。PlayableGraph を破棄するには、この破棄のメソッドを手動で呼び出さなければなりません。そうでない場合は、エラーメッセージが表示されます。
2017–07–04 公開ページ
2017–07–04 Unity 2017.1 で新規NewIn20171
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.