Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Daytene 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!
-
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.
-
Thank you for contacting me , Alex. Just sent you a message :)
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
-
Sounds reasonable. I'll give it a shot, thanks!