playMaker

Author Topic: prefabs not updating small changes to fsms  (Read 4690 times)

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
prefabs not updating small changes to fsms
« on: June 13, 2014, 10:57:37 AM »
Theres a few threads on this dating back a while but I have not gleaned any good coping mechanisms for this issue.

For example im fine tuning a complex hierarchy and change one variable, apply changes to prefab & test the game in the editor. Sometimes the change is applied to the prefab but when i exit playmode the prefab gets reverted to its state before i changed the varaible. Sometimes the changed variable is not applied at all.

This may well be an issue with unity prefabs in general but im only having trouble with fsms & the time this is wasting is not good.

I need some kind of strategy to deal with this so i'm asking here.

Thanks for reading.

FritsLyn

  • Full Member
  • ***
  • Posts: 191
Re: prefabs not updating small changes to fsms
« Reply #1 on: June 13, 2014, 05:07:31 PM »
I also have some serious issues with prefabs and variables.. But I think your (isolated) problem here is what I solve this way:

When ever possible, I work with an instantiated version of the prefab (I drag a prefab to the Hierarchy if it's not already there).

Then I go up in the menu: GameObject -> Break Prefab instance

I do what tweaking I need to with this 'unlinked' copy.

Then I go up in the menu: GameObject -> Apply changes to Prefab

(And then I delete the instantiated copy that now turns blue again)

!

This is insane, I know, but I've found it to be the most reliable way to ensure that what I do is tested live and then saved into the prefab.

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
Re: prefabs not updating small changes to fsms
« Reply #2 on: June 13, 2014, 06:49:47 PM »
Yeah thats quite a counter intuative strategy to rely on the prefab asset remaining intact opposed to keeping a prefab and a scene object hierarchy but I dont doubt your success doing it that way.

The way I normaly work is updating my objects applying the changes to the prefab, breaking the conection & deactivating, testing the prefab in play mode, rinse & repeat.

Its not been a good day & I've had both my scene objects & prefab screw up with no good reason. I just noticed an fsmGameObject variable got swtiched out for different one on another fsm. This is the most complex object in the project...scary :(


Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: prefabs not updating small changes to fsms
« Reply #3 on: June 14, 2014, 12:27:45 AM »
Quote
Sometimes the change is applied to the prefab but when i exit playmode the prefab gets reverted to its state before i changed the varaible. Sometimes the changed variable is not applied at all.

You could be running into the Unity limitation where prefabs cannot store references to scene objects. There are some places in the UI where Playmaker lets you do this when it shouldn't. This will be fixed in the next update. There will also be more feedback when you try to do something that Unity doesn't allow...

The next time you see an edit not apply properly to the prefab note if you were trying to reference a scene object in the prefab.

If that's not the problem then I need more detail so I can try to reproduce it here... E.g., a screencast would be great, or a small repro project even better!


krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
Re: prefabs not updating small changes to fsms
« Reply #4 on: June 14, 2014, 07:27:39 AM »
hello alex

Quote
You could be running into the Unity limitation where prefabs cannot store references to scene objects.

No, this is not what is happening i know you cant ref scene objects from a prefab. What happened is that a reference to a game object INSIDE the prefab was swapped out for an fsmGameObject variable from the same fsm.

I will try & make a screen cast when this happens again but a repro is asking the impossible.

Let me repeat myself so you are left in no doubt. This is only happening with fsms - I have no problems with my scripts & other components.

I know i'm not the only person to get this issue, there are more threads on this & the version of playmaker seems irrelevent. I would aprreciate any information you can provide on how fsms are stored & what is going on when they are stored in prefabs. There is no playmaker fsm file format for me to pick through for errors so you are my only chance at finding what the problem is, so please, could you ellaborate or just guess on some of the likely possible causes for this trouble?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: prefabs not updating small changes to fsms
« Reply #5 on: June 14, 2014, 10:08:30 AM »
The action parameter changed from a direct GameObject reference to a variable name? Or a variable of None?

FsmGameObject types have a GameObject value and a string name. When an FSM is loaded, if the name is defined it searched for GameObject variables in the FSM with that name. If it can't find a local variable it looks in globals. If it can't find a global variable with that name it makes a new variable.

For an FsmGameObject to change from a value to variable reference something has to set the name field. Normally this would be the variable selection UI in the editor.

But it could also be a bug triggered by some specific sequence of events. If we can narrow down when this happens we can find the bug. Also if you can send me a project in a broken state I might be able to figure out the cause.

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
Re: prefabs not updating small changes to fsms
« Reply #6 on: June 14, 2014, 02:03:40 PM »
Quote
The action parameter changed from a direct GameObject reference to a variable name? Or a variable of None?

It was a direct GameObject ref that changed to an fsmVariable (gameObject) that was being used in the same state on a different action (and other states throughout the fsm). At one point I had the (disconnected after applying) scene hierarchy in the way it was made while its prefab had this altered variable on a particular action (get fsmGameObject).

Unfortunatly my best guess on the workflow that sets this off is too vague to be useful, feels like its something to with working on multiple scenes with scene hierarchy's all associated (but disconected) to the same prefab.

I will try & provide you with harder evidence if/when this weirdness occurs in the future as by using the following method normal service seems to be restored.

@FritsLyn you may want to look into this...
According to the method written by ferraribeng at the bottom of this page:  http://answers.unity3d.com/questions/56096/disconnect-prefab.html the disconnected scene hierarchy becomes disassociated with any prefab. I then dragged an empty gameobject onto the troublesome prefab (in the hopes of 'blanking' it as i want to avoid deleting it), deleted the (now blue) emptyObject in the scene then dragged my unassociated  scene hierarchy back onto the prefab.

Now this seems to be working for me (for now) but, your mileage (and mine) may vary.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: prefabs not updating small changes to fsms
« Reply #7 on: June 14, 2014, 04:00:14 PM »
Quote
Unfortunatly my best guess on the workflow that sets this off is too vague to be useful, feels like its something to with working on multiple scenes with scene hierarchy's all associated (but disconected) to the same prefab.

Actually this helps. I've sent you an invite to the beta for the next update. It fixes a hard to reproduce bug with multiple instances of prefabs and apply. It can cause the kind of behaviour you described...