playMaker

Author Topic: Call Method in FixedUpdate [SOLVED]  (Read 2385 times)

Ayyya

  • Playmaker Newbie
  • *
  • Posts: 4
Call Method in FixedUpdate [SOLVED]
« on: September 30, 2017, 06:16:54 PM »
Hi, I using Playmaker to modify character motion. To this end, I am trying to use the "CallMethod" action once every FixedUpdate call. Do you think you could provide a modified "CallMethod" action that supports FixedUpdate? I looked around the forums and in the ecosystem and couldn't find any support for this.
« Last Edit: October 02, 2017, 09:42:49 AM by djaydino »

Ayyya

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Call Method in FixedUpdate
« Reply #1 on: October 01, 2017, 12:49:11 PM »
Hi again,

I was able to add my own custom version of "CallMethod" that I call "CallMethodFixedUpdate" (attached below). I can save this script to my own folder and maintain it on my own. However, when I add it to a state in PlayMaker, and try to attach a behaviour to it, it doesn't auto populate the public methods in the drop down for the "method name" of the behaviour the way that "CallMethod" does.

I found out why. There is another script called "CallMethodEditor" which is responsible for auto populating the behaviour's public methods in the dropdown. I created my own custom "CallMethodFixedUpdateEditor" (attached below) as well. I tried to save this script in my own folder but get namespace compiler errors. If I move it into the "\Assets\PlayMaker\Actions\Editor" folder instead, the compiler errors go away.

Once I do that I am able to attach a behaviour to the "CallMethodFixedUpdate" action and have the public methods auto populate in the "method name" field.

The only problem I have with going this route is that on a future update of PlayMaker, I will have to re-add the "CallMethodFixedUpdateEditor" script to the "\Assets\PlayMaker\Actions\Editor" folder. For this reason, I was hoping that you could officially add a way to make "CallMethod" have an option for  in FixedUpdate.

Any help would be greatly appreciated.
Thanks

Ayyya

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Call Method in FixedUpdate
« Reply #2 on: October 01, 2017, 04:08:35 PM »
I had to make a change in the "CallMethodFixedUpdate" script as the method wasn't being called on every fixed update call. I had to turn on a flag in "OnPreprocess" as follows:

Code: [Select]
public override void OnPreprocess()
{
    Fsm.HandleFixedUpdate = true;
}

Included the new file.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Call Method in FixedUpdate
« Reply #3 on: October 01, 2017, 09:33:07 PM »
Hi,
Have you tried placing the "CallMethodFixedUpdateEditor"
in your folder, inside an "Editor" folder?

Editor folders are use by unity to know if script need to run in editor mode (so while not playing) they can be inside any folder.

Also thank you for sharing

Ayyya

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Call Method in FixedUpdate
« Reply #4 on: October 02, 2017, 09:38:29 AM »
Oh yeah, that fixed it. Thanks for the help.  :)