Note: The UI system here is the Ngui plugin
Title, in the game often encounter this situation, the scene click on the relevant object or button to pop up the corresponding 2D interface, this time in addition to the 2D interface clickable button, etc., should be shielded from the 3D scene of the click or drag events.
Here are two ways of doing this:
1. Add a large enough collider to the 2D interface to cover the entire screen:
// Add a collider to the Corridor Information Panel to mask the mouse click event gameobject.addcomponent<boxcollider> () on the 3D scene when the popup panel is blocked ; Gameobject.getcomponentNew Vector3 (24000);
The way you add components directly in unity without code additions may cause the collider to overwrite buttons on the Ngui interface causing the button to not click, and you should also be aware of the location of the code where the collider is added, or it may cause the problem;
When two interfaces overlap in the Ngui, the response is that of the larger collider interface;
2. When the click and drag events in the scene are implemented with the Fingergestures plugin, the fingergestures script can be invalidated:
Gameobject.find ("fingergestures"false;
When the 2D interface is turned off, the script takes effect:
Gameobject.find ("fingergestures"true;
Block clicks on the 3D scene when Unity pops up the interface