19
2015
Mecanim Simple Trigger Animation Example
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:
– Sprite created with Universal LPC Sprite Sheet Character Generator
References:
– http://docs.unity3d.com/ScriptReference/Animator.StringToHash.html (should be better than using strings)
– http://docs.unity3d.com/ScriptReference/AnimatorStateInfo-shortNameHash.html
– http://docs.unity3d.com/ScriptReference/Animator.SetTrigger.html (Easier to use than Bool parameter, automatically gets set back to false)
Related Posts
Leave a comment
Recent posts
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
- Custom Unity Hub Project Template Preview Image/Video (using HTML+CSS in package description)
- Check if point is inside polygon 2D (using line intersection)
- UnityHub: Enable Create Project Button (without having to select Cloud Organization)
- UI: Make Tooltip background fit Text content length
- Pong-Wars in Unity
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub)
- UnityHub: Add support for custom project title (instead of folder name) or use ProductName
- Testing Unity MUSE AI