playMaker

Author Topic: Animation Event ChangeState  (Read 5038 times)

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Animation Event ChangeState
« on: January 13, 2012, 02:32:45 PM »
I can not get the Animation Events to work.. I have an object that has an event on it "fadeOut"

I add an animation Event and select ChangeState and put fadeOut in the parameter box and i get the error:
Failed to call AnimationEvent ChangeState of class PlayMakerFSM
The function must have either 0 or 1 parameters etc....

When i hover over the Event it says:

ChangeState (Function Not Supported)

Can anyone help.. Kind of a show stopper for me at the moment.

This is on my Mac machine.. I tried on my windows machine and when i add an event the pop up window shows up and disappears again before i can use it... I have strange things happen in the Animation Editor on my Win machine for some reason..

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Animation Event ChangeState
« Reply #1 on: January 13, 2012, 02:39:06 PM »
Well i got the window to come up on my windows machine but it is crazy.. i enter something and then if i hover over the event i get a huge string of errors like AmbiguousMatchException... Maybe i need to delete and reinstall my windows Unity..

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Animation Event ChangeState
« Reply #2 on: January 13, 2012, 03:34:13 PM »
Is this with the 1.2.2 beta or the 1.2.1 release version?

If beta related, please post to the new Playmaker Beta Group.

Thanks!

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Animation Event ChangeState
« Reply #3 on: January 13, 2012, 04:19:18 PM »
Just the standard version.. i have not done any betas

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Animation Event ChangeState
« Reply #4 on: January 13, 2012, 05:04:34 PM »
I think this was broken in 1.2.1 but fixed in the next update.

If you want to stick with 1.2.1 until the next release is ready you could make a little helper MonoBehaviour that forwards the event to an Fsm, and use that method in the AnimationEvent. Let me know if you want to do that  and need a hand making it...

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Animation Event ChangeState
« Reply #5 on: January 13, 2012, 05:27:39 PM »
Ok thanks Alex..

I am in the middle of a kind of big project with a really short time line so i dont really want to get into a beta situation.. If there is some version you think would be ok then i can use it no problem.

If not then i would honestly not know how to make that MonoBehaviour.. So if you had time i would love that. If not i will use my work around that i already made even though it is very cumbersome.

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Animation Event ChangeState
« Reply #6 on: January 13, 2012, 05:41:20 PM »
Here you go. Just add the attached script to the GameObject and use SendEventToFSM in the Animation Event.

Let me know if you run into any problems...

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Animation Event ChangeState
« Reply #7 on: January 13, 2012, 05:48:47 PM »
Sweeeeet thanks. Will try in a bit

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Animation Event ChangeState
« Reply #8 on: January 13, 2012, 11:15:05 PM »
Hey it works.. I had to set the Fsm Component in the Script in inspector to the name of the object it was on.. did not get that right away but it worked good. Thanks

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Animation Event ChangeState
« Reply #9 on: January 14, 2012, 08:01:48 PM »
Sorry, forgot to mention that you have to drag the target onto the Fsm Component field.

Actually I'm thinking this script might be interesting to expand further, so you can broadcast events, target game objects etc. using animation events, without even adding an FSM to the game object...

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Animation Event ChangeState
« Reply #10 on: January 14, 2012, 08:35:04 PM »
Hmmm that might be interesting indeed...

Now i ran into a problem with this approach actually.. I use my own timer and set the Animation Time manually so i can control the flow of things.... Animation Events dont seem to fire properly in this circumstance... which sucks... but anyway i can still use it for some things but not for everything i was hoping for.

I assume it is because i am setting time values and if you dont hit right on the time of the event then it does not work. I totally have a new animation system i want to build with PM anyway. Just need some time to do it.

Or maybe i am doing something wrong.

Q