
The Weapon class is meant to be extended and will define a lot of things common to all or most weapons.

You can of course divert from that, but that’s how all the examples work. The Weapon classesĪll weapons in the Corgi Engine derive from the Weapon class. What the CharacterHandleWeapon component will then do is check for changes on the weapon use button, and if it gets pressed/released, transfer that information to the weapon currently equipped. If you don’t specify one, the weapon will attach to the root level of your prefab. This is a transform on your character (or nested inside its prefab) for the weapon to attach to. From its inspector you’ll be able to optionally select a weapon for your character to start with, define if it can pickup new ones, and specify a Weapon Attachment. To be able to equip and use a weapon, a Character must have a CharacterHandleWeapon component. The engine also includes a few examples of weapons you can have a look at, and that you can use as a basis when creating your own. Then any Monobehavior class can subscribe to Animator Events and do whatever I need.The Corgi Engine includes a generic weapon system, allowing your characters to equip a weapon (projectile based, melee, or whatever you can think of), switch to another one, and use it. I use a pub/sub system for throwing events. Public override void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)ĪnimatorEventManager.Raise(this, update) īase.OnStateUpdate(animator, stateInfo, layerIndex) Public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)īase.OnStateExit(animator, stateInfo, layerIndex) Public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)īase.OnStateEnter(animator, stateInfo, layerIndex) Private static readonly EventManager AnimatorEventManager = EventManager.Registry
#Unity 5.4.2f2 animation event last frame not firing update#
Private static readonly AnimatorUpdate update = new AnimatorUpdate() Private static readonly AnimatorStateExit exit = new AnimatorStateExit() Private static readonly AnimatorStateEnter enter = new AnimatorStateEnter() Public class AnimatorStateEvents : StateMachineBehaviour feet hitting floor = footstep sound animation event, weapon swing = deal damage at specific frame event, etc etc. This is annoying if you have a dedicated script that manages Animation Events, you'd have to make multiple ones, and it can add up to a lot, since you can use Events for a lot of different things. One bug I noticed was that it limits the functions shown per script, so after like 10 functions off the same script, it won't show the rest of them, but it will show other functions to select from from other scripts attached to the GO, but up to a certain number for each script if you get what I'm saying. Once you place one, you have a dropdown menu that shows up with a list of functions available to call (so it'll look at all your scripts that are attached to the same GO your rig is on), it can be quite a long list if you have a lot of scripts attached, but it should work.

This would guarantee 100% accuracy/correctness instead of WaitForSeconds.ītw, this isn't a Unity 5 feature, you can place Anim Events in Unity 4 free. Then you'd directly associate it with your "AnimEnded" function. I would just place an Animation Event at the last frame of animation. Reddit Logo created by /u/big-ish from /r/redditlogos!

Long series.ĬSS created by Sean O'Dowd, Maintained and updated by Louis Hong /u/loolo78 Favors theory over implementation but leaves source in video description. Normally part of a series.Īlmost entirely shader tutorials. Lots of graphics/shader programming tutorials in addition to "normal" C# tutorials. Using Version Control with Unit圓d (Mercurial) Related SubredditsĬoncise tutorials. Unity Game Engine Syllabus (Getting Started Guide)ĥ0 Tips and Best Practices for Unity (2016 Edition) Lots of professionals hang out there.įreeNode IRC Chatroom Helpful Unit圓D Links Use the chat room if you're new to Unity or have a quick question. Please refer to our Wiki before posting! And be sure to flair your post appropriately. Remember to check out /r/unity2D for any 2D specific questions and conversation! A User Showcase of the Unity Game Engine.
