playMaker

Author Topic: Prefab variables sometimes get mixed up when brought into main scene  (Read 1147 times)

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
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!
« Last Edit: October 17, 2020, 08:55:39 PM by SamH »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Prefab variables sometimes get mixed up when brought into main scene
« Reply #1 on: October 18, 2020, 03:38:21 AM »
Hi.
It happens to me as well.
But usually when i restart unity after editing prefab fsms issues are gone.

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Prefab variables sometimes get mixed up when brought into main scene
« Reply #2 on: October 19, 2020, 02:50:17 AM »
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  :'( :'( :'(
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Prefab variables sometimes get mixed up when brought into main scene
« Reply #3 on: October 19, 2020, 06: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.

SamH

  • Playmaker Newbie
  • *
  • Posts: 41
Re: Prefab variables sometimes get mixed up when brought into main scene
« Reply #4 on: October 19, 2020, 02:13:24 PM »
@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.

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Prefab variables sometimes get mixed up when brought into main scene
« Reply #5 on: October 19, 2020, 03: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 :(
indie developer of multiplayer adult fighting
http://nakedfighter3d.com