playMaker

Author Topic: Set Parent Error  (Read 5327 times)

asano83

  • Playmaker Newbie
  • *
  • Posts: 6
Set Parent Error
« on: December 10, 2012, 09:59:37 AM »
I looked but did not find a similar issue to this one so I apologize if this has already been posted.

Whenever I hit play I get this error in the Console of Unity, but I do not get any error notice or have any issues with my FSMs in Playmaker before I hit Play.


[C:/BuildAgent/work/812c4f5049264fad/Runtime/Graphics/Transform.cpp line 260]
(Filename: Assets/PlayMaker/Actions/SetParent.cs Line: 38)

Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
UnityEngine.Transform:set_parent(Transform)
HutongGames.PlayMaker.Actions.SetParent:OnEnter() (at Assets\PlayMaker\Actions\SetParent.cs:38)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:DoTransition(FsmTransition, Boolean)
HutongGames.PlayMaker.Fsm:ChangeState(FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent)
HutongGames.PlayMaker.Fsm:Event(FsmEvent)
HutongGames.PlayMaker.Actions.IntSwitch:DoIntSwitch() (at Assets\PlayMaker\Actions\IntSwitch.cs:49)
HutongGames.PlayMaker.Actions.IntSwitch:OnEnter() (at Assets\PlayMaker\Actions\IntSwitch.cs:29)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:Update()
PlayMakerFSM:Update()

I am not sure what the issue is here?  As my actions create the object then the next action is supposed to set the newly created object's parent through a Set Parent Action.  These errors pop up in the console and the newly created game objects are not parenting the way they should.  Should I separate the two actions into different FSMs?

Thanks in advance!


velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
Re: Set Parent Error
« Reply #1 on: December 10, 2012, 02:38:12 PM »
you need to search for it by tag instead of by gameobject prefabs.  i'm having the same issue and tags are the only solution.

asano83

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Set Parent Error
« Reply #2 on: December 11, 2012, 02:58:12 AM »
Thanks for the response Shawn, but I am not sure what specifically you mean search for the tag instead of the prefab objects? I'm using the Set Parent action to try and attach the newly created object as a child to the parent object, so that the new child's position aligns with that of the parent object.  How will searching for the tag or setting the tag change that?


velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
Re: Set Parent Error
« Reply #3 on: December 11, 2012, 11:13:16 AM »
"Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption."

you get this error because you are directly referencing a prefab in your library.  you need to reference the prefab in your scene.  to do that, you need to search for the prefab by tag so it finds it in your scene and stops giving you that error.

velketor

  • Junior Playmaker
  • **
  • Posts: 69
  • Multimedia Marathon Man
    • Shawn Kilian Portfolio
Re: Set Parent Error
« Reply #4 on: December 11, 2012, 11:29:02 AM »
use 'find game object' action and store it in a gameobject variable and then use that variable to change your prefab from within the scene instead of the prefab in your library.

asano83

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Set Parent Error
« Reply #5 on: December 13, 2012, 03:33:20 AM »
Thanks for your help Shawn! I got rid of the error.  I am just having an issue now though with parenting the new game object variables together in the scene? Can I still use Set Parent with the game object variables?  I tried last night but the action wasn't firing off and my suspicion is that the Set Parent action is not recognizing the game object variables I made. 

Thanks again for your help!!