You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Copy file name to clipboardExpand all lines: documentation/how-to-guides/scripting/handle-input.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -280,12 +280,33 @@ For pointer events (`onPointerClick`, etc.) to work:
280
280
281
281
1.**Object must be visible** - `visible = true`
282
282
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
+
:::
284
288
285
289
:::tip For input on invisible objects use Layer Masks
286
290
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.
287
291
:::
288
292
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?
Copy file name to clipboardExpand all lines: documentation/reference/api/input-events.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -205,8 +205,12 @@ When using browser events directly, you need to handle platform differences your
205
205
For input events to work:
206
206
207
207
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.
0 commit comments