playMaker

Author Topic: LateUpdate not working in build (FSM template in instantiated prefab)  (Read 388 times)

lukew

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Playmaker version: 1.9.0.p10
Unity version: 2018.3.6f

Hey,

After updating Playmaker and Unity I'm checking consistency between the editor and build. I've noticed that a lot of our important prefabs (Player, NPCs etc.) are not working in build while they work fine and same as before in the editor.

I've tried to find what's the reason of that and after checking things step by step I was able to reproduce the issue in the fresh project so it could be easier to catch the problem.

1. Create a PlayMaker FSM template in new project.
2. Use action with LateUpdate mode checkbox (tested on Set Position) and set it as true, don't use 'every frame'. Add a FINISH transition event from this state.
4. Add some states after the state with Set Position action to see if they are working after the state with Set Position is finished.
3. Create a prefab and use the template in prefab.
4. In the tested scene, create another object that will spawn the prefab into the scene (tested both with FSM 'create object' and c# Instantiate).

In editor everything works fine. The state with Set Position is finished, action is applied and all actions after it are working fine.

In build (PC, Mac and Linux standalone [tested only on PC Windows]) the Set Position action is not applied and actions after it are not working at all.

I've tested it in scenes where the prefabs are placed and saved in the scene instead of spawning them from other fsm/script and the template work.

I also works if the prefab uses FSM with same actions and logic but without a template.

EDIT: I'm comparing the logs nad I'm not sure but it could be that the handler is not created when it uses a template.

"AddEventHandlerComponent: PlayMakerLateUpdate" is logged in build with prefab without a template while I don't see this message in build that uses template.

Anyway I'm not sure as I think that I was getting this message in my main project even if the template was used.

Doublechecked this and there is no "AddEventHandlerComponent: PlayMakerLateUpdate" message in the build that only spawns a prefab with template.
« Last Edit: March 04, 2019, 08:52:52 AM by lukew »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3618
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: LateUpdate not working in build (FSM template in instantiated prefab)
« Reply #1 on: March 07, 2019, 12:17:36 PM »
Thanks for the detailed bug report. Will try to reproduce here...

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3618
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: LateUpdate not working in build (FSM template in instantiated prefab)
« Reply #2 on: March 08, 2019, 01:21:05 PM »
There's a new update (1.9.0.p11) that should fix this issue.
The problem was with pre-processing prefabs in 2018.3+.
Let me know if this fixes the issue for you!

lukew

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Hi Alex,

Thanks for checking this out. I'm in process of checking how it works now so here is small update.

I've updated Playmaker to 1.9.0.p15 (Unity 2018.3.7f).

As previously, everything works fine in editor.

As for the builds. Looks like some problems with LateUpdate are fixed. Some templates that were not working in builds on 1.0.0.p11 works fine now.

I see that there are some problems with LookAt and SmoothLookAt actions, looks like they are not working in the build (on prefabs that use FSM templates). I need to make some simple test in empty build to doublecheck it.

EDIT: Looks like its not about the actions but something else. I need to investigate the templates.

With this update I've noticed that Playmaker is now running some process before the editor starts to build a player. Looks like it iterates through all prefabs that are included in the build and runs some kind of preprocessing, am I right? I can see that some prefabs that include many FSMs are updated many times.

Is it happening only for FSMs that are 'embedded' in the prefabs or for templates too?
« Last Edit: May 06, 2019, 09:09:47 AM by lukew »

lukew

  • Playmaker Newbie
  • *
  • Posts: 32
    • View Profile
Small update related to the LateUpdate actions.

They work on prefab with template, when the template is attached to the parent GameObject. When the template is attached to a child GameObject of the prefab, the action is not working in the build.

Any chance that child objects are not preprocessed so the LateUpdate handler is not added to them by PlayMaker when building a player? It's possible that this problem is related to all LateUpdate actions but I need to check it once again.

Edit: checked it with SetPosition with LateUpdate set to true. Same effect. Works in editor but not in build.

SetPosition with LateUpdate set to false works both in editor and in build.

---

In the meantime. Is there any way to add the handler manually somehow? Or maybe force it to be added?

Edit2: I've added LateUpdate handler manually to the child with the template attached and added the FSM to its "Target FSMS" list. Looks like it works in the build now. Is this a proper workaround for now?

Thanks.
« Last Edit: May 06, 2019, 02:38:52 PM by lukew »