{"id":1677,"date":"2019-03-27T21:56:09","date_gmt":"2019-03-27T12:56:09","guid":{"rendered":"http:\/\/naochang.me\/?p=1677"},"modified":"2019-04-01T14:26:46","modified_gmt":"2019-04-01T05:26:46","slug":"timeline%e3%81%ae%e3%83%90%e3%82%a4%e3%83%b3%e3%83%89%e3%82%92%e8%a7%a3%e9%99%a4","status":"publish","type":"post","link":"https:\/\/stacstar.jp\/blog\/?p=1677","title":{"rendered":"Timeline\u306e\u30d0\u30a4\u30f3\u30c9\u3092\u89e3\u9664"},"content":{"rendered":"<p>\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3067 WrapMode \u3092 Hold \u306b\u3057\u305f\u969b\u306b\u3001\u305d\u306e\u5f8c Animator \u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u5236\u5fa1\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u3002\u4f8b\u3048\u3070\u30aa\u30fc\u30d7\u30cb\u30f3\u30b0\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u3042\u3068\u306b\u30b9\u30bf\u30fc\u30c8\u30dc\u30bf\u30f3\u3060\u3051\u30dc\u30bf\u30f3\u3092\u62bc\u3055\u308c\u305f\u3068\u304d\u306b Animator \u3067\u30dc\u30bf\u30f3\u306e\u30a2\u30cb\u30e1\u3092\u518d\u751f\u3055\u305b\u305f\u3044\u3068\u304b\u305d\u3093\u306a\u5834\u5408\u3001\u30dc\u30bf\u30f3\u3092\u5305\u3080 GameObject \u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u3063\u3066\u3001Timeline \u3067\u306f\u305d\u3063\u3061\u3092\u5236\u5fa1\u3059\u308b\u306a\u3093\u304b\u306e\u5de5\u592b\u304c\u5fc5\u8981\u306b\u306a\u3063\u3066\u304f\u308b\u3002<\/p>\n<p>Timeline \u3092\u6d41\u3057\u305f\u5f8c\u3001\u5225\u306e Timeline \u3092\u6d41\u3059\u5206\u306b\u306f\u554f\u984c\u306a\u304f\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u6d41\u308c\u308b\u3051\u3069\u3001Animator \u3067\u306e\u5236\u5fa1\u304c\u52b9\u304b\u306a\u3044\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"border aligncenter size-full wp-image-1679\" src=\"\/blog\/wp-content\/uploads\/timeline_bind_playtimeline.gif\" alt=\"\" width=\"670\" height=\"500\" \/><\/p>\n<p><!--more--><\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089 Timeline \u306e\u30c8\u30e9\u30c3\u30af\u306b\u7d10\u3065\u3044\u3066\u3044\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u306a\u304f\u3057\u3066\u3042\u3052\u308b\u3068\u3001Timeline \u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306f\u52d5\u304b\u306a\u308a\u3001 Animator \u3067\u306e\u5236\u5fa1\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"border aligncenter size-full wp-image-1681\" src=\"\/blog\/wp-content\/uploads\/timeline_bind_clearbind.gif\" alt=\"\" width=\"670\" height=\"500\" \/><\/p>\n<p>\u540c\u3058\u3088\u3046\u306a\u51e6\u7406\u3067\u3001\u518d\u5ea6\u30d0\u30a4\u30f3\u30c9\u3057\u76f4\u3057\u3066\u3042\u3052\u305f\u308a\u3001\u5225\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30d0\u30a4\u30f3\u30c9\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"border aligncenter size-full wp-image-1682\" src=\"\/blog\/wp-content\/uploads\/timeline_bind_rebind.gif\" alt=\"\" width=\"670\" height=\"500\" \/><\/p>\n<p>\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u52d5\u304b\u3057\u3066\u3042\u3052\u305f\u3044\u5834\u5408\u306b\u306f\u305d\u3082\u305d\u3082 Animator \u306e\u65b9\u3092\u30aa\u30d5\u306b\u3057\u3066\u3042\u3052\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"border aligncenter size-full wp-image-1680\" src=\"\/blog\/wp-content\/uploads\/timeline_bind_unableanimator.gif\" alt=\"\" width=\"670\" height=\"500\" \/><\/p>\n<pre class=\"brush: unitycsharp; title: ; notranslate\" title=\"\">\r\nusing System.Collections.Generic;\r\nusing UnityEngine;\r\nusing UnityEngine.Playables;\r\nusing UnityEngine.Timeline;\r\nusing UnityEngine.UI;\r\n\r\npublic class ClearTimelineBindings : MonoBehaviour\r\n{\r\n    &#x5B;SerializeField]\r\n    private PlayableDirector timeline01;\r\n\r\n    &#x5B;SerializeField]\r\n    private PlayableDirector timeline02;\r\n\r\n    &#x5B;SerializeField]\r\n    private Transform imageTrans;\r\n\r\n    &#x5B;SerializeField]\r\n    private Text animationEnableTxt;\r\n\r\n    &#x5B;SerializeField]\r\n    private GameObject bindGO;\r\n\r\n    private Animator animator;\r\n\r\n    private void Start()\r\n    {\r\n        this.animator = this.imageTrans.GetComponent&lt;Animator&gt;();\r\n    }\r\n\r\n    public void PlayTimeline01()\r\n    {\r\n        this.timeline01.time = 0f;\r\n        this.timeline01.Play();\r\n    }\r\n\r\n    public void PlayTimeline02()\r\n    {\r\n        this.timeline02.time = 0f;\r\n        this.timeline02.Play();\r\n    }\r\n\r\n    public void SetTriggerAnimator01()\r\n    {\r\n        this.animator.SetTrigger(&quot;Animation01&quot;);\r\n    }\r\n\r\n    public void SetTriggerAnimator02()\r\n    {\r\n        this.animator.SetTrigger(&quot;Animation02&quot;);\r\n    }\r\n\r\n    public void SwitchAnimator()\r\n    {\r\n        this.animator.enabled = !this.animator.enabled;\r\n        this.animationEnableTxt.text = &quot;Animator\\n&quot; + (this.animator.enabled ? &quot;ON&quot; : &quot;OFF&quot;);\r\n    }\r\n\r\n    public void ScaleByScript()\r\n    {\r\n        this.imageTrans.localScale *= 1.1f;\r\n    }\r\n\r\n    public void ClearBinds()\r\n    {\r\n        this.BindToTimelines(null);\r\n    }\r\n\r\n    public void BindGameObject()\r\n    {\r\n        this.BindToTimelines(this.bindGO);\r\n    }\r\n\r\n    public void BindToTimelines(GameObject go)\r\n    {\r\n        foreach (PlayableDirector timeline in new &#x5B;]{this.timeline01, this.timeline02})\r\n        {\r\n            IEnumerable&lt;TrackAsset&gt; tracks = (timeline.playableAsset as TimelineAsset).GetOutputTracks();\r\n\r\n            foreach (TrackAsset track in tracks)\r\n            {\r\n                timeline.SetGenericBinding(track, go);\r\n            }\r\n        }\r\n    }\r\n}\r\n<\/pre>\n<p>\u7279\u5b9a\u306e\u540d\u524d\u306e\u30c8\u30e9\u30c3\u30af\u3060\u3051\u30aa\u30d5\u306b\u3057\u305f\u3044\u306e\u3067\u3042\u308c\u3070<\/p>\n<pre class=\"brush: unitycsharp; title: ; notranslate\" title=\"\">\r\n(timeline.playableAsset as TimelineAsset)\r\n    .GetOutputTracks()\r\n    .First(t =&gt; t.name == &quot;****&quot;);\r\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u540d\u524d\u3067\u53d6\u308c\u308b\u3002<br \/>\n\u672c\u5f53\u306f\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3(\u5236\u5fa1)\u3057\u3066\u3044\u308b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u308a\u305f\u304b\u3063\u305f\u3093\u3060\u3051\u3069\u305d\u308c\u306f\u53d6\u308c\u306a\u3044\uff1f\uff1f<\/p>\n<p>\u3061\u306a\u307f\u306b\u30c8\u30e9\u30c3\u30af\u540d\u306e\u8a2d\u5b9a\u306f<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/timeline_bind_trackname.png\" alt=\"\" width=\"316\" height=\"65\" class=\"border aligncenter size-full wp-image-1692\" srcset=\"https:\/\/stacstar.jp\/blog\/.\/wp-content\/uploads\/timeline_bind_trackname.png 316w, https:\/\/stacstar.jp\/blog\/.\/wp-content\/uploads\/timeline_bind_trackname-300x62.png 300w\" sizes=\"auto, (max-width: 316px) 100vw, 316px\" \/><br \/>\n\u30c8\u30e9\u30c3\u30af\u3092\u9078\u629e\u3057\u305f\u30a4\u30f3\u30b9\u30da\u30af\u30bf\u30fc\u304b\u3089\u3002<\/p>\n<p>\u8ffd\u8a18) 2019.04.01<br \/>\n<span class=\"keyword\">Activation Track<\/span>\u3067\u306f\u89e3\u9664\u3057\u3066\u3082\u3046\u307e\u304f\u52d5\u4f5c\u3057\u306a\u3044\u3053\u3068\u304c\u3042\u3063\u305f&#8230;<br \/>\n\u72b6\u6cc1\u306b\u3082\u3088\u308b\u3051\u3069<span class=\"keyword\">Control Track<\/span> \u3068\u304b\u4f7f\u3063\u3066\u3042\u3052\u308b\u3068\u3046\u307e\u304f\u3044\u304f\u304b\u3082\u3002<br \/>\n\u3082\u3057\u304f\u306f<a href=\"\/blog\/?p=1695\" target=\"_self\">\u3053\u3061\u3089\u306e<\/a>\u8a18\u4e8b\u53c2\u7167\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30bf\u30a4\u30e0\u30e9\u30a4\u30f3\u3067 WrapMode \u3092 Hold \u306b\u3057\u305f\u969b\u306b\u3001\u305d\u306e\u5f8c Animator \u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u5236\u5fa1\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u3002\u4f8b\u3048\u3070\u30aa\u30fc\u30d7\u30cb\u30f3\u30b0\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u3042\u3068\u306b\u30b9\u30bf\u30fc\u30c8\u30dc\u30bf\u30f3\u3060\u3051\u30dc\u30bf\u30f3\u3092\u62bc\u3055\u308c\u305f\u3068\u304d\u306b Anim [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-1677","post","type-post","status-publish","format-standard","hentry","category-unity"],"_links":{"self":[{"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1677"}],"version-history":[{"count":11,"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1677\/revisions"}],"predecessor-version":[{"id":1700,"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1677\/revisions\/1700"}],"wp:attachment":[{"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stacstar.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}