Playmaker Forum

Playmaker News => Playmaker Announcements => Topic started by: jeanfabre on August 10, 2017, 11:22:25 PM

Title: PlayMaker 1.8.5 LateUpdate handling change
Post by: jeanfabre 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 (https://github.com/jeanfabre/PlayMakerCustomActions_U4/blob/master/Assets/PlayMaker%20Custom%20Actions/__Internal/FsmStateActionAdvanced.cs) class, check out FloatClampAdvanced (https://github.com/jeanfabre/PlayMakerCustomActions_U4/blob/master/Assets/PlayMaker%20Custom%20Actions/Math/FloatClampAdvanced.cs) for an example on how to use it.


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

Bye,

 Jean
Title: Re: PlayMaker 1.8.5 LateUpdate handling change
Post by: Deek 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.
Title: Re: PlayMaker 1.8.5 LateUpdate handling change
Post by: jeanfabre 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