- Home /
[Solved]Cursor emulation with canvas?
Hello,
I'm trying to make a cursor emulation (Gamepad moves sprite on screen which acts as a cursor + button 0 makes a click).
Current approach:
Raytrace 3D + 2D + Canvas
SendMessage -> OnMouseUp etc.
However, I'm having issues ray tracing canvas elements.
http://docs.unity3d.com/Manual/script-GraphicRaycaster.html needs a event and not a coordinate. I then tried faking an event but RaycastResult is not found.
EDIT:
You need to import: using UnityEngine.EventSystems;
This question is pretty much the same: http://answers.unity3d.com/questions/820599/simulate-button-presses-through-code-unity-46-gui.html
Your answer
Follow this Question
Related Questions
Make the player shoot towards a mouse click 2d Platformer 1 Answer
Raycast and box collider not working properly 2 Answers
Clicking multiple objects with same tag, how to "forget" the one clicked previously... 0 Answers
UI System not blocking Raycasts on Mobile only 2 Answers
Raycast moved object won't go under certain height 3 Answers