{"id":2394,"date":"2021-02-02T12:44:41","date_gmt":"2021-02-02T04:44:41","guid":{"rendered":"https:\/\/www.clonefactor.com\/wordpress\/?p=2394"},"modified":"2021-02-02T12:44:43","modified_gmt":"2021-02-02T04:44:43","slug":"solution-for-animator-become-uninitialized-after-setgenericbinding-and-removed-from-timeline","status":"publish","type":"post","link":"https:\/\/www.clonefactor.com\/wordpress\/program\/unity3d\/2394\/","title":{"rendered":"Solution for Animator become uninitialized, after SetGenericBinding()-> and removed from timeline."},"content":{"rendered":"\n<p>During the development on <a href=\"https:\/\/www.clonefactor.com\/wordpress\/public\/2353\/\" data-type=\"post\" data-id=\"2353\">\u7528 TimeLine \u4f86\u5be6\u4f5c\u8df3\u8d8a\u969c\u7919\u7269<\/a>, I discover the Animator will be uninitialized.<br>waiting the answer on <a rel=\"noreferrer noopener\" href=\"https:\/\/forum.unity.com\/threads\/after-setgenericbinding-animator-and-remove-them-the-animator-become-uninitialized-for-a-while.1049987\/\" data-type=\"URL\" data-id=\"https:\/\/forum.unity.com\/threads\/after-setgenericbinding-animator-and-remove-them-the-animator-become-uninitialized-for-a-while.1049987\/\" target=\"_blank\">Forum,<\/a> but the solution I made up was manually re-initialize all private reference and avoid keeping the long term reference on SMB,<\/p>\n\n\n\n<p>here is the sample code to detect Animator become uninitialized.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">private bool m_AnimationDirty = false;\nprivate void Update()\n{\n\tif (!m_AnimationDirty &amp;&amp; !animator.isInitialized)\n\t{\n\t\tm_AnimationDirty = true;\n\t\tDebug.LogWarning(\"Animator dirty\", animator);\n\t}\n\telse if (m_AnimationDirty &amp;&amp; animator.isInitialized)\n\t{\n\t\tm_AnimationDirty = false;\n\t\tReInitSMB(); \/\/ reinitialize reference right here.\n\t\tDebug.Log(\"Animator Re-init SMB reference.\", animator);\n\t}\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>During the development on \u7528 TimeLine \u4f86\u5be6\u4f5c\u8df3\u8d8a\u969c\u7919\u7269, I d &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105,11,106],"tags":[114],"class_list":["post-2394","post","type-post","status-publish","format-standard","hentry","category-animator-","category-unity3d","category-devlog","tag-hack"],"_links":{"self":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/2394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2394"}],"version-history":[{"count":1,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/2394\/revisions"}],"predecessor-version":[{"id":2395,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/2394\/revisions\/2395"}],"wp:attachment":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}