line renderer question

i create one empty gameobject & attach line rendered that object have only line renderer no other rendered attach to this game object so, my question is when i press a key or when collide some object then i want just uncheck this line renderer so, its like invisible object

the easy way to do this is a line renderer with 2 vertex

MyLineRenderer.SetVertexCount(2);
MyLineRenderer.SetPosition(0,myFirstObjectPosition);
MyLineRenderer.SetPosition(1,mySecondObjectPosition);

this will make a line between the 2 objects by this you need to attach the LineRenderer to the script and the first and second object positions you can get them from GameObject.Find("NameOfYourObjectToFind").Transform.Position

long time since it was asked, hope helps others