playMaker

Author Topic: PlayMaker 1.8.5 LateUpdate handling change  (Read 2752 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13053
  • Official Playmaker Support
    • View Profile
PlayMaker 1.8.5 LateUpdate handling change
« on: August 10, 2017, 11:22:25 PM »
Hi Everyone,

 So this post is about release 1.8.5 onwards and how Late Update call is handled differently now for performances. It's important to read and understand this for developers who create and maintain custom actions but also for non coders if your game doesn't work as expected, it could be something to look for before going nuts :)


Now for an action to catch LateUpdate, you need to register for this inside the OnPreprocess method

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

Few tips:

- Don't do this on Awake() or any other methods, OnPreprocess() is the right place and the most efficient time to set this up.

- for publishers and custom actions writers that share it on the forum or on the Ecosystem, if you want your action to work across all PlayMaker versions for backward compatibility, make use of the compiler flag PLAYMAKER_1_8_5_OR_NEWER and you are sure to have your action to work for any PlayMaker versions.

Code: [Select]
#if PLAYMAKER_1_8_5_OR_NEWER
Fsm.HandleLateUpdate = true;
#endif

- If you create actions that let the user choose between Update, lateUpdate or fixedUpdate, make use of the FsmStateActionAdvanced class, check out FloatClampAdvanced for an example on how to use it.


If you have any doubts or questions, just get back to us :)

Bye,

 Jean
« Last Edit: August 10, 2017, 11:33:16 PM by jeanfabre »

Deek

  • Full Member
  • ***
  • Posts: 112
    • View Profile
Re: PlayMaker 1.8.5 LateUpdate handling change
« Reply #1 on: December 30, 2017, 02:18:38 PM »
I went through my scripts searching for every instance of OnLateUpdate() to make sure they are up-to-date after this change (luckily quite easy with VS2017) and found that (unlike most PlayMaker and custom actions) the following actions aren't updated with the OnPreProcess()-prerequisite yet:

PlayMaker Actions (1.8.5):
"ArrayForEach"

Custom Actions:
"iTweenRotateUpdate2"
"TorqueLookRotation"

For the iTween one you'd need to add:
Code: [Select]
public override void OnPreprocess()
{
    if(updateCall == PlayMakerUpdateCallType.FixedUpdate)
    {
        Fsm.HandleFixedUpdate = true;
    }

    #if PLAYMAKER_1_8_5_OR_NEWER
    if(updateCall == PlayMakerUpdateCallType.LateUpdate)
    {
        Fsm.HandleLateUpdate = true;
    }
#endif
}

For every other action the following suffices:
Code: [Select]
public override void OnPreprocess()
{
    #if PLAYMAKER_1_8_5_OR_NEWER
    Fsm.HandleLateUpdate = true;
    #endif
}

You might want to delete this (my) post after updating those actions to keep this topic clean or notify me to do so.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 13053
  • Official Playmaker Support
    • View Profile
Re: PlayMaker 1.8.5 LateUpdate handling change
« Reply #2 on: January 18, 2018, 11:50:32 PM »
Hi,

 thanks for spotting this, this is addressed ( will be fixed in the next playmaker update, and you can redownload from the ecosystem for the other actions).

 Bye,

 Jean