Hi,
I try to use IPointerEnterHandler & IPointerExitHandler, but I can’t get it working
I instantiate an Entity at runtime with a Prefab
EntityCommandBuffer ecb = new(Allocator.Temp);
Entity entity = ecb.Instantiate(grid.ValueRO.prefab);
ecb.AddComponent(entity, new LocalTransform
{
Position = new float3(...),
Rotation = Quaternion.identity,
Scale = 1.0f
});
ecb.Instantiate(entity);
I tried using it with a MonoBehaviour as part of the Prefab, which is working, as there I also use an InputAction to receive a mouse click
But IPointerHandler won’t fire
public class MouseWatcher : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
public InputAction Input;
private void OnEnable()
{
Input.performed += MouseClicked;
Input.Enable();
}
public void OnPointerEnter(PointerEventData eventData) // not working
{ }
public void OnPointerExit(PointerEventData eventData) // not working
{ }
private void MouseClicked(InputAction.CallbackContext ctx) // working fine
{ }
}
How can this be done right?
I those IPointerHandlers do not work within ECS, what would be a way to do a gameobject hover effect in ECS?
Best regards