- Home /
Question by
hawken · Dec 02, 2015 at 11:09 AM ·
uiraycastingeventsystemscreentoworldpoint
offset the position of a click on uGUI
How can I activate a button or any uGUI element at an offset position?
Trying a lot of different approaches here, but nothing seems to work.
here's the code to offset the Vector2:
GameObject plotter;
Transform offset;
Vector3 pos;
void Update() {
pos = camera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 0));
pos -= offsetamount.position;
plotter.transform.position = pos;
}
I'm trying to access the button under the offset position with raycastResults but not having much luck at getting it to find things!
Comment
Your answer
Follow this Question
Related Questions
GraphicRaycaster seems to ignore Toggle elements 1 Answer
Problem with Graphic Raycast and using it with Xbox Controller 0 Answers
How to send mouse events directly to the canvas in world pos 0 Answers
SteamVR Slider won't drag using VR Controller,SteamVR-controller can't drag Slider handle 0 Answers
Cursor.lockstate and OnPointerEnter not working together 2 Answers