how do i show my "debug.DrawLine" on the in-game as well? pls help guys

guys. quick help… sorry but I’m shocked that no one have this answer on google. I want my “debug.DrawLine” shown in-game as well. I heard lineRenderer but so far no answer actually shows you how to do it the exact position and the “debug.drawLine”. pls help?

    void detection()
    {
        Ray ray = new Ray(transform.position, transform.forward);

        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, 100))
        {
            Debug.DrawLine(ray.origin, hitInfo.point, Color.red);
            transform.Translate(-Vector3.forward * boost * Time.deltaTime);
            rb.useGravity = false;

        } else
        {
            Debug.DrawLine(ray.origin, ray.origin + ray.direction * 100, Color.blue);
            rb.useGravity = true;
       
        }

    }

just attach LineRenderer component and :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class myclass : MonoBehaviour
{
    public LineRenderer lineRenderer;
void detection()
    {
     Ray ray = Ray(transform.position, transform.forward);
     RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, 100))
        {
            Debug.DrawLine(ray.origin, hitInfo.point, Color.red);
            transform.Translate(-Vector3.forward * boost * Time.deltaTime);
            rb.useGravity = false;

      
        lineRenderer =  GetComponent<LineRenderer>();
        lineRenderer.SetPosition(0,ray.origin);
        lineRenderer.SetPosition(1,hitInfo.point );

        } else
        {
            Debug.DrawLine(ray.origin, ray.origin + ray.direction * 100, Color.blue);
            rb.useGravity = true;
        }
    
   }

For a real game, DrawLine looks bad. That’s why it’s editor-only. A line-renderer can have a dotted line on it, with a width. Or even better, use a long, thin column. Or an arrow might be better – a ball placed on one end, an arrowhead on the other, with the line between. Or some people want to place the line “on the ground”, always facing up. That would be just a stretched-out quad.

You could hand-make various things to see what looks best, then figure out how to have it go between any 2 spots.