Hello Needle,
I done the update to the 3.25.2, after that one of my script which implement IPointerClickHandler (I tried with IPointerEventHandler too) doesn’t work anymore.
I really don’t know why.
Did somebody has an idea ?
Original Post on Discord
by user 224464722878005248
My code is like :
export class SelectableTooth
extends Behaviour
implements IPointerEventHandler
{
...
onPointerEnter() {...}
onPointerExit() {...}
etc
My others functions work, but the functions liked to IPointerEventHandler doesn’t work anymore
by user 224464722878005248
But it works for my others functions like my HotSpot Behaviour
by user 224464722878005248
marwie1
(marwi)
November 24, 2023, 12:00am
4
Make sure you have an ObjectRaycaster component in the hierarchy above (or on the same object) as your EventHandler component
I maybe found, it’s maybe because the check 'ignore skinned mesh" is checked
by user 224464722878005248
marwie1
(marwi)
November 24, 2023, 12:00am
6
Ah yes that could also be a reason. We’ve added this recently and will improve it further. The reason for this is that raycasting on skinned meshes is by default very expensive and previous versions have done this for every frame with an EventSystem. Subsequent versions will improve this even further and only raycast objects that have components in their hierarchy that are actually listening to those events
It’s not that…
by user 224464722878005248
by user 224464722878005248
marwie1
(marwi)
November 24, 2023, 12:00am
9
Is your object by any chance on layer 2 ?
I don’t know what’s going on, it’s working for my hotspot but not for my tooth models
by user 224464722878005248
I will check but normally no
by user 224464722878005248
marwie1
(marwi)
November 24, 2023, 12:00am
12
Ah my bad - it’s because skinned meshes are currently completely ignored for raycasting in the EventSystem.
by user 224464722878005248
Nop
by user 224464722878005248
With AND without the case checked ?
by user 224464722878005248
marwie1
(marwi)
November 24, 2023, 12:00am
16
I might have a workaround for you, one second
marwie1
(marwi)
November 24, 2023, 12:00am
17
//@type UnityEngine.MonoBehaviour
export class SkinnedMeshRaycaster extends ObjectRaycaster {
constructor() {
super();
this.ignoreSkinnedMeshes = false;
}
}
export class MyEventHandler extends Behaviour implements IPointerEventHandler {
onPointerEnter(args: PointerEventData) {
console.log("ENTER", args);
}
}
This works
marwie1
(marwi)
November 24, 2023, 12:00am
18
You can add a custom raycaster
Hmmm
by user 224464722878005248
marwie1
(marwi)
November 24, 2023, 12:00am
20
in this case we just derive from ObjectRaycaster since we want to use it’s logic (all the raycasting is already done)