Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: itszander on September 25, 2012, 12:44:53 PM

Title: NGUI and playmaker
Post by: itszander on September 25, 2012, 12:44:53 PM
Hi all, i'm getting the hang of nGUI and want to integrate with  playmaker.  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. In this case it's my UI Root for nGUI.
3. have that ui element have a specific layer set to my 2d camera

In playmaker I Create Object then Activate Object then 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 hierachynot correctly nested under UI Root.

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. Has anyone else had this problem?

This is an issue only for things that are created, activated and destroyed.  All my other nGUI UI is sweet.
help?

-zander
Title: Re: NGUI and playmaker
Post by: ArenMook on September 25, 2012, 05:05:48 PM
I'm not familiar with what Playmaker does here, so it might be a better question to ask on the Playmaker forums. Generally with NGUI you shouldn't instantiate first then parent later. It should happen all at once, and using NGUITools.AddChild method as it ensures that the object will be on the proper layer.