Game Development Reference
In-Depth Information
To assign an object to an IgnoreRaycast layer, just select the object in the scene and
then click on the Layer dropdown in the Object Inspector, assigning the object to the
Ignore Raycast layer, as shown in the following screenshot:
Assigning objects to the Ignore Raycast layer
But even this just isn't feasible sometimes. Often you'll need multiple cameras and
many objects with colliders, and they'll sometimes obscure objects you want to select
or adjust according to mouse input events. In these cases, you may need to manually
handle mouse input events. The following code sample 4-8 achieves these, invoking
specific mouse events manually on the basis of input. In essence, this code uses the
Raycast system to redirect manually detected input events to the MonoBehaviour
mouse events. This code uses Coroutines too; considered after the code sample:
using UnityEngine;
using System.Collections;
//---------------------
public class ManualMouse : MonoBehaviour
{
//---------------------
//Get collider attached to this object
private Collider Col = null;
//---------------------
 
Search WWH ::




Custom Search