Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: BehindTheStone on October 21, 2013, 04:27:46 PM
-
Hey there,
so in order to stop Input on Buttons (and other stuff) I created in my a "STOPINPUTCOLLIDER" which is a GameObject with a Transform and only a BoxCollider; set to Trigger.
I change his Center.Z value like I want to certain values, most the time it is set to -15 so no button on screen (which have center.z values from 0 to -10) can be touched.
This worked great for me.
NOW in 3.X I'm experiencing some weird stuff with this method. It kind of works in a different, weird and for my purposes not userfriendly way. It doesn't matter if I change the Value of the center.z, Buttons can be pressed. I managed to find out what the problem was. The Depth of the Background-Sprites of the Buttons.
When set to 0 or something negative the STOPINPUTCOLLIDER works, but as soon the Depth-Value of some sprites are set to 1 or above, the STOPINPUTCOLLIDER is ignored and every button can be touched.
Is there a solution to that or a workaround?
-
I just read that changing on the Z-Axis has no effect at all. Tried that out and it seems to be true. That is really bad news. Changing Depth does NOT work for me, since changing Depth rearranges the Sprite-Draw-Order.
Please tell me there is a solution :(
-
In 3.0.3 you can just add an empty UIWidget with a collider on it to intercept events.
-
I only have 3.0.2 and don't own a Professional License. A workaround for now would be great.
But I'm still interested in the empty Widget-thing. Does it just intercept the events or is it still depth-related, since I need the collider to stop the input on a certain Z-Value
-
Change your UICamera to use "World" type instead of "UI" type and it will behave the same way it did in pre-3.0.2.
-
Uff, that saved my life.
But just for the record: where is the difference between "World" and "UI". Is it better to use the latter?
-
World raycasts into colliders. UI raycasts into widgets. World won't clip raycasts based on scroll views. UI will. So... world is faster. But UI is more designed for... UIs.
-
You can also add a full on UISprite to the collider and adjust the depth on that, just set the alpha to 0.
-
Ah you mean placing an "invisible" sprite with a collider above all the other ones, right?
Hm, that should work, I guess.
Anyway, thanks for the help! :)
-
Yeah, that's what I mean. It's not pretty, but it works. If we can place a "dummy" UIWidget in future versions then that will be nicer.