- First, the role of the UI camera
- Uicamera need to be mounted on the camera to play a role
- Uicamera is only responsible for sending Ngui events to the objects that are visible in the camera attached to the script, such as I have customized the Ngui layer (added in the Inspector panel) and set the layer of all UI elements under UI root to a custom Ngui layer.
- Event delivery depends not only on the Layer object on which the camera is mounted, but also on the event mask,eventmask in the UI camera script, which determines which game object's layer can be used to receive events (one or more layers). You can manually select the hierarchy object, but make sure that you need to send the event's layer layers in both the eventmask in the Uicamera script and the culling mask of the unity camera that the script is mounted on, otherwise the event cannot be sent to the object in the target layer.
- Optimization: You can check the camera's culling mask and Uicamera script Eventmask to everything, which guarantees that there will be no error. However, this causes the event to be broadcast when the global game object needs to be broadcasted, resulting in reduced efficiency and performance consumption , it is better to choose a layer precisely to send events, such as when you are using a single camera for small map rendering.
- (ii) Uicamera attribute Panel field parsing
Uicamera of Deep excavation NGUI Foundation (II.)