Cant get positioning to work in game view
im trying to draw a line between 2 buttons, but for some reason the positioning in the game view is completely off.... in the editor camera it looks perfectly fine... here are a few pictures of what im talking about: http://imgur.com/a/1nrnq
this is the code i use to draw the line:
 void DrawLine(Vector3 start, Vector3 end, Color color, float duration)
     {
         GameObject myLine = new GameObject();
         myLine.transform.position = start;
         myLine.AddComponent<LineRenderer>();
         LineRenderer lr = myLine.GetComponent<LineRenderer>();
         lr.material = new Material(Shader.Find("Legacy Shaders/Diffuse"));
         lr.SetColors(color, color);
         lr.SetWidth(3.1f, 3.1f);
         lr.SetPosition(0, start);
         lr.SetPosition(1, end);
         GameObject.Destroy(myLine, duration);
     }
 
               the camera is in ortographic and the canvas is in Screen Space - overlay.... when i set it to Screen Space - Camera or World Space, then the line position is fine, but all other positions are wrong... like, i move the buttons to the location of the mouse with this:
 public void OnDrag (PointerEventData eventData)
     {
         // this doesnt work either
         //transform.position = new Vector3(Input.mousePosition.x,Input.mousePosition.y, 100);
         transform.position = eventData.position;
     }
 
               but this is the result (prnt screen doesnt save pointer, so the cross is where the mouse is)
Your answer
 
             Follow this Question
Related Questions
Major Issues with Camera Switching 1 Answer
Animated Sprites blocked by Canvas 1 Answer
Getting all sprites to render inside of the Perspective camera 1 Answer
UI Button not accurate 1 Answer
Android Camera does not show Image 1 Answer