Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: SamH on October 17, 2020, 05:51:16 PM

Title: Prefab variables sometimes get mixed up when brought into main scene
Post by: SamH on October 17, 2020, 05:51:16 PM
I wasn't able to find any other reports of this issue, so let me post it and see if anyone else has experienced this.

Occasionally when I have worked on a prefab object FSM (by double clicking on the asset and opening it up in its own scene), I will save and return to my main scene file to find that some of the variables in the instance of the prefab have been jumbled up.  ie 'Int_Variable_A' inside an action has been switched out for 'Int_Variable_B'.   If I return back into my prefab scene, all the variables there are correct. Jumping back into my main scene file again, they are still jumbled.

Note this is not an issue with me overriding values on an instance of a prefab in my main scene file. This happens even if the prefab doesn't exist at all in the main scene hierarchy (and is created freshly by a playmaker 'create object' action after hitting play).

Some additional info:
-When the issue occurs it will soemtimes jumble up lots of different variables in a few states and actions.
-As the variables are switched randomly, 'luckily' it breaks my scene so catastrophically that its usually very apparent that the issue has occurred so I know to look for it.
-Its pretty infrequent that I get this issue.. but does pop up every few days
-The mix up does persist into a build of the game. Its not just an issue in my unity scene.
-Weirdly, if I change the problematic variable in my action (in the prefab file) to something else, save, then change it back to the correct variable and click save it does NOT correct/refresh the problem in my scene file.
-Luckily though I do have a very easy fix. If I create an empty state in my prefab FSM, click save, then delete the empty state and click save again, when I return to the main scene file this completely resolves the issue.

In my screenshot 'Prefab' You see the correct variable 'FloorManager_go'.
In the screenshot 'SceneInstance' you see what this same action looks like on the instance of the prefab- 'Current_Money_go' is in its place. Which is another random variable which was in use somewhere else in the prefab.

Sorry I don't have any exact repro steps to reliably reproduce it.. but I did make a video of the issue last time I saw that which I can provide if it helps.  Thanks!
Title: Re: Prefab variables sometimes get mixed up when brought into main scene
Post by: djaydino on October 18, 2020, 12:38:21 AM
Hi.
It happens to me as well.
But usually when i restart unity after editing prefab fsms issues are gone.
Title: Re: Prefab variables sometimes get mixed up when brought into main scene
Post by: nFighter on October 18, 2020, 11:50:17 PM
I believe my issues can be somehow connected to this. Prefab variables (usually strings) sometimes got mixed or lost. At first, I thought I just forgot or accidentally edit something, but now I see that all my data stored on prefab variables could be lost spontaneously  :'( :'( :'(
Title: Re: Prefab variables sometimes get mixed up when brought into main scene
Post by: djaydino on October 19, 2020, 03:19:38 AM
Hi.
On prefabs i do not have the issue. but on variants i do.

what i do if i need to do changes on a fsm on a variant prefab.

Make changes, then make a new fsm.
Then copy every thing from the old fsm and paste to the new fsm
Then remove the old fsm.
Title: Re: Prefab variables sometimes get mixed up when brought into main scene
Post by: SamH on October 19, 2020, 11:13:24 AM
@nFighter  For me the prefab itself is always intact and contains all the correct info. Its just the instances that get mixed up

@djaydino The quickest fix I found is to just create a blank state in the prefab, save, then delete the state and save. Something about doing this reliably refreshes all the information and completely resolves the issue on all the instances.
Title: Re: Prefab variables sometimes get mixed up when brought into main scene
Post by: nFighter on October 19, 2020, 12:15:22 PM
Sorry, I also mean “prefab variants”. Clean prefab and one fsm works fine.

But “prefab variants” with “fsm template” on them are broken. I tried to keep everything organized and editable, so changes in original prefab should be propagated to all prefab variants and changes to fsm template should be reflected on all objects, but variable values get mixed up all the time :(