playMaker

Author Topic: Prevent playmaker from breaking prefab connection  (Read 290 times)

christougher

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
Prevent playmaker from breaking prefab connection
« on: January 28, 2019, 04: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?

Groo Gadgets

  • Full Member
  • ***
  • Posts: 126
    • View Profile
Re: Prevent playmaker from breaking prefab connection
« Reply #1 on: January 28, 2019, 10:53:37 PM »
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?

christougher

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
Re: Prevent playmaker from breaking prefab connection
« Reply #2 on: January 29, 2019, 02: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... 

Groo Gadgets

  • Full Member
  • ***
  • Posts: 126
    • View Profile
Re: Prevent playmaker from breaking prefab connection
« Reply #3 on: January 29, 2019, 06: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  :-)

christougher

  • Playmaker Newbie
  • *
  • Posts: 34
    • View Profile
Re: Prevent playmaker from breaking prefab connection
« Reply #4 on: January 30, 2019, 01: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.