Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: cayou on July 27, 2013, 02:12:40 PM

Title: [RTS] Using NGUI and click into the 3d world
Post by: cayou on July 27, 2013, 02:12:40 PM
Hi there !
I'm working on a RTS game right now, and I have some issues using NGUI and some mouse controls into the game.
If I create a button into the UI camera, if I click on it, the code I made to click to the terrain in the 3d world will still be called.

How can I prevent this? I mean, I want to know if I click into the UI I won't raycast to my terrain.

Thanks !
Title: Re: [RTS] Using NGUI and click into the 3d world
Post by: Nicki on July 27, 2013, 02:18:39 PM
Make a fullscreen collider under all your GUI, which handles a boolean that you have to look at to use your ingame click/dragging.

When the fullscreen collider is hit, allow dragging, when it's not it means a button was above it and took the touch, so don't allow dragging then.

Does that make sense?
Title: Re: [RTS] Using NGUI and click into the 3d world
Post by: cayou on July 27, 2013, 02:23:23 PM
I have to be sure that the NGUI callback will be called before the code to select into 3d world, but it could work.
I'll try !

Thanks.
Title: Re: [RTS] Using NGUI and click into the 3d world
Post by: cayou on July 27, 2013, 02:44:42 PM
Okay, it worked !
I have a function that allow the 3d clicking, it's called when the fullscreen collider is pressed.
And another one which block the 3d clicking into the same collider, on release event.

A bit tricky, but it works ;)