I am trying to make a phone game and I need to split the screen in 4 sections by drawing the diagonals oof the screen. I looked over every tutorial on this site about drawing lines using LineRenderer and so far, that’s the only way that I can use to draw a line wider than 1 pixel (I need it to be 3 pixels wide).
The main problem is: I can only make the diagonal between the top-right corner and the bottom-left one show up when I build the app. If i run the game on my computer, through UnityRemote on my phone, both of the diagonals show up, but if I build it, only one gets drawn.
This is the code I am using to draw the diagonal that is working:
using UnityEngine;
using System.Collections;
public class Lines1 : MonoBehaviour {
private LineRenderer line;
public Material material;
// Use this for initialization
void Start () {
line = new GameObject("Line").AddComponent<LineRenderer>();
line.material = material;
line.SetVertexCount(2);
line.SetPosition(0, new Vector3(Screen.width, Screen.height));
line.SetPosition(1, new Vector3(0, 0));
line.SetWidth(3, 3);
line.useWorldSpace = true;
}
// Update is called once per frame
void Update () {
}
}
Since I can’t draw 2 lines with one LineRenderer, I created 2 objects, each one with a LineRenderer and 2 scripts, one for each line, to draw them. The only difference between the scripts are the lines where I set the position of the start point and the end point of the line. For example, in my 2nd script, I have
line.SetPosition(0, new Vector3(Screen.width,0)); line.SetPosition(1, new Vector3(0, Screen,height));
I will attach 2 photos of the game, with both of the scripts running, both on my computer and on my phone, after I build it.
This is how the game looks when I run it on my computer:
This is how the game looks on my phone, after I build the app (ignore the placement of the sprites and that text in the middle of the screen…they’re just a few things I will take care of after I get over this problem):
I thought about using other methods, like GL.Begin(), but I am not too familiar with that, so it would be perfect if I can do everything with LineRenderers

