SpriteFactory.Sprite.OnSpriteFrameStart
C#: void OnSpriteFrameStart (SpriteFactory.Sprite.FrameEvent frameEvent)
JS: function OnSpriteFrameStart (frameEvent : SpriteFactory.Sprite.FrameEvent) : void
Description
If the current frame has a frame event, this message will be sent when the frame begins playing. This message is sent to all component siblings of the Sprite.
This can be used to trigger an action each time a frame plays, for example, playing a sound effect during certain frames of a walk cycle or attack animation. To receive this message, place the following in a script and add the script as a component to the same GameObject with the Sprite component.
C#
void OnSpriteFrameStart(SpriteFactory.Sprite.FrameEvent frameEvent) { if(frameEvent.eventString == "MyEvent") { // place your code here } }
JS
function OnSpriteFrameStart(frameEvent : SpriteFactory.Sprite.FrameEvent) : void { if(frameEvent.eventString == "MyEvent") { // place your code here } }
See Also
OnSpriteFrameEnd