Skip to content

Commit e659ad7

Browse files
committed
docs: clarify pointer events need no Collider; document Ignore Raycast = layer 2
Pointer/click events raycast against visible mesh geometry — a Collider is only required for physics raycasts. Add explicit callouts, a 'no setup required' note (ObjectRaycaster is auto-added), and an 'onPointerClick not firing' troubleshooting checklist so the docs answer this directly. Note 'Ignore Raycast' is layer 2.
1 parent 1ac6d9c commit e659ad7

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

documentation/how-to-guides/scripting/handle-input.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,33 @@ For pointer events (`onPointerClick`, etc.) to work:
280280

281281
1. **Object must be visible** - `visible = true`
282282
2. **GameObject needs geometry** - A mesh
283-
3. **Layer not set to "Ignore Raycast"**
283+
3. **Layer not set to "Ignore Raycast"** (layer `2`)
284+
285+
:::tip No Collider needed for clicks
286+
Pointer events raycast against the object's **visible mesh geometry** — just add your component to a mesh and clicks work. A `Collider` is only required for **physics** raycasts (`this.context.physics.engine.raycast()`), not for `onPointerClick` and the other pointer events.
287+
:::
284288

285289
:::tip For input on invisible objects use Layer Masks
286290
By default only visible objects receive input events. You can set the object's layer mask to a different layer, then disable rendering for that layer in the main camera. This way the object can still receive pointer events while being invisible.
287291
:::
288292

293+
### No setup required
294+
295+
There is **no `EventSystem` or raycaster component to add manually**. The first time a pointer event is needed, Needle Engine automatically adds an `ObjectRaycaster` to the scene and routes hits to your components. Just add a component with an `onPointerClick` (or other pointer) method to a mesh and it works.
296+
297+
---
298+
299+
## Troubleshooting: `onPointerClick` not firing
300+
301+
If your pointer event method is never called, check these in order:
302+
303+
1. **Is the component on (or above) a mesh?** Pointer events raycast against **visible mesh geometry**. Add the component to the GameObject that has the mesh, or a parent of it.
304+
2. **You do _not_ need a `Collider`.** Clicks work without any physics collider — a `Collider` is only for physics raycasts (`this.context.physics.engine.raycast()`). Adding one is not required and won't fix a non-firing click on its own.
305+
3. **Is the object visible?** Only visible objects receive input by default (`visible = true`). For input on hidden objects, use [Layer Masks](#requirements-for-pointer-events).
306+
4. **Is the layer raycastable?** The object's layer must not be set to "Ignore Raycast" (layer `2`), which the raycaster skips.
307+
5. **Is the method spelled exactly `onPointerClick`?** Method names are case-sensitive (`onPointerClick`, `onPointerDown`, `onPointerEnter`, …) and take a single `PointerEventData` argument.
308+
6. **Is the component enabled and the object active** in the hierarchy?
309+
289310
---
290311

291312
## Touch Gestures

documentation/reference/api/input-events.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,12 @@ When using browser events directly, you need to handle platform differences your
205205
For input events to work:
206206

207207
1. **Object must be visible** (`visible = true`)
208-
2. **Object's layer** must not be set to "Ignore Raycast"
209-
3. **GameObject must have a collider** - Only required when using physics-based raycasting. For regular pointer events, a mesh with geometry is sufficient.
208+
2. **Object's layer** must not be set to "Ignore Raycast" (layer `2`)
209+
3. **GameObject has visible mesh geometry** - Pointer events raycast against the mesh itself.
210+
211+
:::tip No Collider needed for clicks
212+
A `Collider` is **only** required for physics raycasts (`this.context.physics.engine.raycast()`). Regular pointer events like `onPointerClick` raycast against the visible mesh, so adding your component to a mesh is enough.
213+
:::
210214

211215
---
212216

0 commit comments

Comments
 (0)