Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Goosery on April 16, 2014, 01:05:30 PM

Title: Collider blocking other UIs
Post by: Goosery on April 16, 2014, 01:05:30 PM
Hi, I have searched for 2 days and have not found the answer so here it goes.

I'm using NGUI 2.5.1 and it's hard to upgrade to the latest version without breaking my game or tonnes of regression I don't have time for so I'm stuck with this version.


I have many UIs in my game, each has their UIRoots and a Camera+UICamera.  All of them are culled to a layer called "ui"  And Event Receiver Mask also set to "ui"

Everything works great!  I wrote a script that rotates my camera using unity's Input.GetTouch() but that is very badly written and does not work that well so I replaced it entirely with NGUI's OnDrag, here I will explain.

I have 1 special UI that needs to be independent from all these UIs, for the purpose of the camera rotate function.  What this UI is, is really not a UI but a box collider that covers the whole screen and has a script that receives OnDrag even from the UICamera.

This works really well, however, many times when I instanciate one of my UIs, which has it's own camera, the large collider of the camera rotating "UI" blocks off everything and thus none of my UIs will function anymore.

I have tried using a dedicated camera that is in a different layer than "ui" which was exclusively used for NGUI, so I figured maybe I need a new layer that is dedicated for just the camera rotate OnDrag stuff.. but that still does't help, the collider still blocks off everything.

I tried moving the collider very far from the camera, but that does nothing.  I tried figuring if I can set a depth by making the collider have a UILabel component so I can set the dept(what a hack I tried lol) but still that does nothing.

Please let me know how I can get around this.  If I am unclear in my description I will provide better detail. Hope to hear from you soon.

Thanks!
Title: Re: Collider blocking other UIs
Post by: ArenMook on April 17, 2014, 10:51:37 AM
I honestly don't remember what 2.5.1 had, but UICamera has a "fallThrough" target you can set which will receive all events that didn't affect widgets. Likewise there is the "genericEventHandler" you can set that will receive a copy of all events, whether they were handled by NGUI or not. I suggest using those. Other than that there isn't much I can do as 2.5.1 is extremely old and like the rest of NGUI 2 isn't supported anymore.
Title: Re: Collider blocking other UIs
Post by: Goosery on April 17, 2014, 11:07:47 AM
How do you use the fall though?  Via code?  Does that mean every UI I instantiate will need do some work on the UICamera to enable this fallthrough, so that the large camera rotating collider won't block it?  Please elaborate or point me in the right direction thanks!

If you have an upgrade guide for Ngui 2.5.1 that would be cool too. thx!
Title: Re: Collider blocking other UIs
Post by: ArenMook on April 17, 2014, 01:16:30 PM
It's a static object. Once you set it in the scene via a script, that object will be receiving events.

Upgrade 2.5.1 to 2.7.0, and only then go up to NGUI 3 following the video tutorial.