playMaker

Author Topic: Scripts Don't Work In Build  (Read 1555 times)

Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Scripts Don't Work In Build
« on: April 06, 2021, 02:54:39 PM »
Hello! The problem is that certain Playmaker scripts attached to objects in prefabs work perfectly in editor but do not work in build.

Worth mentioning:

• I found a weird solution. Right before my first scene, the menu, loaded, I added another scene which is almost empty. The game stays on this scene for a few seconds and then goes on. That solves the problem, however when I create more prefabs using Playmaker scripts, some of them stop working again. The problem solves by increasing waiting time on this empty scene. Of course, it's kinda ineffective since this waiting is already quite long.

• The issue occured a few months ago and since then I tried updating Playmaker for no avail.

• Unity version: 2019.2.17f1; Playmaker version: 1.9.1 p4. Build made for Windows.

It would be cool if someone could suggest a solution.
Thank you in advance!
« Last Edit: April 06, 2021, 05:51:17 PM by Daytene »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Scripts Don't Work In Build
« Reply #1 on: April 06, 2021, 10:58:20 PM »
It sounds very strange and I'm not sure what might cause this. Are you able to share the project? If so please PM me a link.

Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #2 on: April 07, 2021, 03:52:57 AM »
Thank you for contacting me , Alex. Just sent you a message :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Scripts Don't Work In Build
« Reply #3 on: April 07, 2021, 07:11:53 AM »
Hi.
can you also show the fsms.

is it depending on scene objects.

i had issues before due to things that had to be set on fsm 1 or before fsms 2
and on build it randomly did fsm 1 first and fsm after which gave issues.

also for example i had a bool test or fsm bool test which was not set to 'Every Frame' and it worked every time in editor, but on build it gave issues.

Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #4 on: April 07, 2021, 08:07:11 AM »
Hello! Screenshots of the FSMs I currently having issues with attached to the message.

Execution of both FSMs doesn't depend on other FSMs. The first uses the skill when a player clicks on the button and the second shows information window describing the skill when a player hovers cursor over the button.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Scripts Don't Work In Build
« Reply #5 on: April 07, 2021, 10:45:43 AM »
What do the red circles mean in the screenshots?

Have you checked the logs from the player:
https://docs.unity3d.com/Manual/LogFiles.html

Are you doing any async operations? E.g., when loading the scene.
Does anything else enable/disable the GameObjects or FSMs?
Try adding a Debug Log action to the Start State and log "Ready" to check when it's actually enabled.

Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #6 on: April 07, 2021, 11:47:45 AM »
Oh, my bad, forgot to mention the red circles. They mean the key states which players interact with by hovering mouse cursor and clicking.

No, I don't do any async operations and nothing can disable and enable those objects and their FSMs. They're just created when the player enters the scene.

I haven't checked the logs. Thank you for bringing it up! I'll try your suggestions regarding the debug log tomorrow.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Scripts Don't Work In Build
« Reply #7 on: April 07, 2021, 05:01:41 PM »
Hi.
On the 'skill use' fsm you are getting active scene, that might have an issue

Are you using Set Active scene after loading a scene.
are you loading additive scenes?

When is the scene or prefab with the 'skill use' fsm loaded.



Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #8 on: April 07, 2021, 05:18:34 PM »
I don't use Set Active Scene and all scenes are loaded not additively.

The order is the following:
Scene loaded ---> Local object's FSM creates the object with the Skill Use FSM ---> The created object immediately executes all of its FSMs including Skill Use.

It's worth to mention that all other actions which get the active scene work correctly.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Scripts Don't Work In Build
« Reply #9 on: April 08, 2021, 09:02:45 AM »
Hi,
So the Skill Use FSM is a prefab loaded into the scene.

I don't really understand why you are using 'Get Active Scene' there.
as it looks like you are using single scene's

You might have some action or asset that uses don't destroy on load, which might give the issue.

Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #10 on: April 08, 2021, 01:24:04 PM »
There are various scenes in the game which loaded not additively but using a single mode. Some objects like the one with the Skill Use FSM may appear on different scenes and interact with them differently as well. For example, this Skill Use FSM cannot be used outside of battles so it has to block itself on other scenes. That's why I need Get Active Scene — to explain objects where they are :)

I doubt that Don't Destroy On Load might give the issue since I don't remember it's used anywhere in the game. Unfortunately, I didn't try the Debug Log diagnosis yet (which Alex suggested above) so it's difficult to say for sure. I'll write here as soon as I try it.


Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #11 on: April 09, 2021, 05:07:00 AM »
For some odd reason I cannot reproduce the bug. I reduced waiting time on that empty scene greatly and everything still works fine. Don't remember any major changes from the last time.

I guess the problem may be in that the game didn't have enough time to load FSMs in prefabs and waiting on the empty scene gave extra time to load them. And now, I made some changes (which I don't remember) which reduced number of operations the game has to do when loading. And that made it possible for the game to process FSMs in prefabs which it previously couldn't due to the lack of time. Just my assumptions anyway :)

I'll continue watching this and in case the bug will occur again I'll write here with more details.
« Last Edit: April 09, 2021, 05:18:20 AM by Daytene »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Scripts Don't Work In Build
« Reply #12 on: April 09, 2021, 02:54:36 PM »
Hi.
On creating the object you could set a int/bool/string but using 'Set Fsm Actions'

So for example if it can be used in battle, use Set Fsm Bool and have a variable on the prefab called (for example) CanUseInBattle

Then inside the prefab you can check that bool.
this way if you would have new scenes you don't have to add them every time.
Also it will be less prone to have issues.

Daytene

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Scripts Don't Work In Build
« Reply #13 on: April 10, 2021, 04:08:33 AM »
Sounds reasonable. I'll give it a shot, thanks!