Whty would ScreenPointToLocalPointRectangle return a negative position?
I have the following function public void OnTimelineBarClicked(BaseEventData data) { PointerEventData pointerData = data as PointerEventData;
Vector2 localCursor;
if (!RectTransformUtility.ScreenPointToLocalPointInRectangle pointerData.pointerPress.GetComponent<RectTransform>(), pointerData.position, null, out localCursor))
return;
if (IsDebug)
Debug.Log("TimeLineclicked " + localCursor);
}
Seems pretty straight forward. I verified that I am using the RectTransform from the correct object. However, I am getting negative numbers when I click to the left of the pointerPress object, which falls outside what I is the 0 location. It also falls short by the same amount on the right side of the gameObject. This is all in 2D. So it is as if the gameobject was shifted to the left by a small amount (20 in my case) Any clues as to what might cause this? The GameObject is left aligned to the parent. And the pivot is set to x=0 y=0.5 . What else can I look at?
Your answer
Follow this Question
Related Questions
[Solved] Scroll not working when elements inside have click events 3 Answers
What is the best way to implement a more responsive custom drag event with Scroll Rect? 0 Answers
Custom InputHandler is giving different results between Editor and final Build 0 Answers
inspector button to capture a new selected object in scene or hierarchy view 0 Answers