{"id":4130,"date":"2015-12-19T03:41:14","date_gmt":"2015-12-19T00:41:14","guid":{"rendered":"http:\/\/unitycoder.com\/blog\/?p=4130"},"modified":"2015-12-19T03:41:14","modified_gmt":"2015-12-19T00:41:14","slug":"mecanim-simple-trigger-animation-example","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2015\/12\/19\/mecanim-simple-trigger-animation-example\/","title":{"rendered":"Mecanim Simple Trigger Animation Example"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"4131\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2015\/12\/19\/mecanim-simple-trigger-animation-example\/mecanim_unity_trigger_shoot_anim_1\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/12\/mecanim_unity_trigger_shoot_anim_1.gif?fit=373%2C209&amp;ssl=1\" data-orig-size=\"373,209\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mecanim_unity_trigger_shoot_anim_1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/12\/mecanim_unity_trigger_shoot_anim_1.gif?fit=373%2C209&amp;ssl=1\" class=\"alignnone size-full wp-image-4131\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/12\/mecanim_unity_trigger_shoot_anim_1.gif?resize=373%2C209\" alt=\"mecanim_unity_trigger_shoot_anim_1\" width=\"373\" height=\"209\" \/><\/p>\n<p>Simple test project, triggering shoot animation on key press, and not triggering it, if its already running.<br \/>\nAlso one Animation event call included, could be used to spawn the projectile at correct frame.<\/p>\n<p><strong>Project sources:<\/strong><br \/>\n<a href=\"https:\/\/github.com\/unitycoder\/UnityMecanimBasicAnim\" target=\"_blank\">https:\/\/github.com\/unitycoder\/UnityMecanimBasicAnim<\/a><\/p>\n<p><strong>Resources:<\/strong><br \/>\n&#8211; Sprite created with <a href=\"http:\/\/gaurav.munjal.us\/Universal-LPC-Spritesheet-Character-Generator\/#?body=darkelf2&amp;clothes=longsleeve_brown&amp;mail=none&amp;quiver=none&amp;weapon=bow&amp;hat=none&amp;legs=robe_skirt\" target=\"_blank\">Universal LPC Sprite Sheet Character Generator<\/a><\/p>\n<p><strong>References:<\/strong><br \/>\n&#8211; <a href=\"http:\/\/docs.unity3d.com\/ScriptReference\/Animator.StringToHash.html\" target=\"_blank\">http:\/\/docs.unity3d.com\/ScriptReference\/Animator.StringToHash.html<\/a> (should be better than using strings)<br \/>\n&#8211; <a href=\"http:\/\/docs.unity3d.com\/ScriptReference\/AnimatorStateInfo-shortNameHash.html\" target=\"_blank\">http:\/\/docs.unity3d.com\/ScriptReference\/AnimatorStateInfo-shortNameHash.html<\/a><br \/>\n&#8211; <a href=\"http:\/\/docs.unity3d.com\/ScriptReference\/Animator.SetTrigger.html\" target=\"_blank\">http:\/\/docs.unity3d.com\/ScriptReference\/Animator.SetTrigger.html<\/a> (Easier to use than Bool parameter, automatically gets set back to false)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple test project, triggering shoot animation on key press, and not triggering it, if its already running. Also one Animation event call included, could be used to spawn the projectile at correct frame. Project sources: https:\/\/github.com\/unitycoder\/UnityMecanimBasicAnim Resources: &#8211; Sprite created with Universal LPC Sprite Sheet [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4131,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Mecanim Simple Trigger Animation Example","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[420,3],"tags":[830,584,691,242,304,834,833,88,832,831],"class_list":["post-4130","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-unity3d","tag-anim","tag-animation","tag-animator","tag-event","tag-mecanim","tag-once","tag-play","tag-shoot","tag-state","tag-trigger"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2015\/12\/mecanim_unity_trigger_shoot_anim_1.gif?fit=373%2C209&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-14C","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/4130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=4130"}],"version-history":[{"count":1,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/4130\/revisions"}],"predecessor-version":[{"id":4132,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/4130\/revisions\/4132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/4131"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=4130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=4130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=4130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}