Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: HDFrisk on April 04, 2014, 09:03:43 AM

Title: CenterOnChild returns inactive gameobject
Post by: HDFrisk on April 04, 2014, 09:03:43 AM
Hi.
I've searched the forum but could not find any fix to my problem, so here it is.

I have a UIGrid with UICenterOnChild script and 4 childed game objects in my grid(lets call them page1, page2, page3 and page4).
If I get the current centered child(activeCenterChild.centeredObject), having all 4 children in my grid active, it returns the right one.
But if I toggle 2 of them off, say for example page1 and page2, leaving only page3 and page4 active, when I center on page3, which is now my first object, activeCenterChild.centeredObject returns page1, even though I have checked the hide inactive checkbox. Is there a cache that needs to be cleared?

I have made a temporary fix, by moving the objects I want to toggle off to another parent, so UIGrid don't have them as children any more. Is the hideInactive really working?

/HDFrisk
Title: Re: CenterOnChild returns inactive gameobject
Post by: ArenMook on April 04, 2014, 10:26:47 PM
UICenterOnChild has a Recenter() function that you should call whenever you modify the content.
Title: Re: CenterOnChild returns inactive gameobject
Post by: HDFrisk on April 05, 2014, 09:22:08 AM
Hi, thanks for fast reply.
That gives med the correct gameobject indeed, but it results in a non correct pivot point for my grid, resulting in a scrollview able to scroll 4 pages and not only the 2 active pages. I tried rebuilding panels, repositioning the grid.
Title: Re: CenterOnChild returns inactive gameobject
Post by: ArenMook on April 05, 2014, 11:52:25 AM
There is no logic in UICenterOnChild that would "ignore" certain children. If you need that logic you will need to add it yourself.