playMaker

Author Topic: Creating panels under a parent  (Read 2413 times)

itszander

  • Playmaker Newbie
  • *
  • Posts: 12
Creating panels under a parent
« on: September 25, 2012, 12:44:03 PM »
Hi all, i'm getting the hang of playmaker and i'm trying to do the following:

1. create a ui element from a prefab
2. have that UI parent to a specific parent in the hierarchy
3. have that ui element have a specific layer.

I use Create Object then Activate Object then Set layer the Set Parent.

I've noticed that I can't Set Parent correctly. What happens is that after I create the UI prefab, it sits in the top of the hierachy but the FSM looks like it's completed correctly. Set layer works fine tho.  I also notice that if  I try this on something already in the scene, the set parent works fine. 

I'm guessing this has to do with prefabs but the big question is how do I get a prefab to be a child of a specific gameobject already in the scene. The backstory to this is that i'm trying to get hte GO to sit under the UIRoot for nGUI.

help?

-zander
 

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Creating panels under a parent
« Reply #1 on: September 27, 2012, 01:19:41 AM »
Hi,

 when you instanciate a prefab, you can get a reference to the newly created object in the scene, you can then use "set parent" action to parent it to anything you want. I am not sure what is happening with your parenting. Maybe you are not parenting to the right transform?

you can't set the parent of the prefab itself, you have to set it on the instanciate gameObject ( use the "store Object" of the "Create Object" action.

bye,

 Jean