Playmaker Forum

PlayMaker News => General Discussion => Topic started by: christougher on January 28, 2019, 06:14:18 PM

Title: Prevent playmaker from breaking prefab connection
Post by: christougher on January 28, 2019, 06:14:18 PM
Hi, I'm having problems working with a gameobject that needs to retain its relationship with the prefab, but every time I mess with an FSM in playmaker disables the connection. can I disable this behavior?
Title: Re: Prevent playmaker from breaking prefab connection
Post by: Groo Gadgets on January 29, 2019, 12:53:37 AM
You can edit the FSM by clicking on your object in the project view, any changes you make will be updated in the prefab residing in your scene.

Does that make sense?
Title: Re: Prevent playmaker from breaking prefab connection
Post by: christougher on January 29, 2019, 04:32:51 AM
Yes, but the scene object has parts of the fsm that references other scene objects which will get overridden.  With the new prefab workflow I can't seem to find a way to reconnect a scene object with it's broken prefab either... 
Title: Re: Prevent playmaker from breaking prefab connection
Post by: Groo Gadgets on January 29, 2019, 08:36:33 AM
By default, you can't reference scene objects within prefabs.

There are a few solutions to this:
1. If you are instantiating prefabs you can "inject" references to scene objects by using the "Set FSM Game Object" action. I usually do this by having a "Master Control" object with an FSM in my scene
2. You can save references to scene objects to global game object variables, that way your prefab can just reference global variables instead of a direct link to a scene object
3. If your prefab is always resident in your scene then just break the prefab connection entirely; simply put, just keep it in your scene as a non-prefab object

Hope this helps  :-)
Title: Re: Prevent playmaker from breaking prefab connection
Post by: christougher on January 30, 2019, 03:09:45 AM
I appreciate your thorough responses, and I would love to solve everything by breaking the prefab relationship, however that causes problems with the CoreGamekit plugin with the new prefab workflow as the prefab connection is required... Maybe I'll just hook up some global variables but I'd really like an option to forgo fsm changes from breaking the prefab connection without my permission.