playMaker

Author Topic: [SOLVED] Animation Events - How to trigger a "SendEvent" from read-only anims  (Read 3429 times)

Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Hiya, bit stumped on this one... so I've got some animations I've purchased, which have some animation events already set up for them and I basically want to use these to play some footstep sounds. So far so good, the events are all there, and Unity is logging that the events are firing, it's just asking for something to receive them. This is where it gets a bit tricky for me though, I can't quite figure out how to get these events to Send an Event or something that I can then work with in Playmaker.

I've done a lot of searching and seen people use the Animation window to tweak/add the events, to trigger a SendEvent action, or reference an Event Proxy Wizard script, but the trouble is, all the animations are imported .FBX files, and are read-only, so I can't actually modify the Events in the Animation window. All I seem to have direct access to is the Events from the .fbx import settings window, like below:



But from here I'm stumped. Is there something I can put in here to fire off an Event that I can receive in an FSM - or do I need to be able to access them in the Animation window?

Any help really appreciated! Thank you!
« Last Edit: May 10, 2018, 08:47:53 AM by Kathar »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Hi.
You need to Copy the animation and use that :)

Here is a video explaining ho to do so :


Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Thanks alot for that Djay, did consider that, but as there's so many animations which are all tied quite heavily into the Mecanim system, it looked like it was gonna take a really long time to do. Definitely the way to go if there were fewer animations though!

I did manage to find another solution though! Just made a script as in the video below, which receives the Animation Event function calls then Sends that Event to my FSM :)


Boom, job done! Appreciate your time and help!

Edit: .js code below in case anyone needs this in future. Just pop on gameobject that contains the FSM you want to receive the Events, then drag and drop FSM onto script public var. Obviously just change the function names from FootL/R etc. to whatever your AnimationEvent is firing off.
Code: [Select]
var AnimationEventFSM : PlayMakerFSM;
AnimationEventFSM = this.gameObject.GetComponent.<PlayMakerFSM>();

function FootL ()
{
AnimationEventFSM.Fsm.Event("FootL");
}

function FootR ()
{
AnimationEventFSM.Fsm.Event("FootR");
}
« Last Edit: May 10, 2018, 08:47:37 AM by Kathar »