DrawRay only visible in pause mode but not ingame

Hello everyone,
I’m just trying to make a gun able to shoot things and dealing damage to targets and i’ve tried putting a “laser” onto my gun but it’s only visible when i’m in pause mode (attached a video about it)

This is my code for it.

Debug.DrawRay(muzzle.position, muzzle.forward * gunData.maxDistance, Color.red);

This is the video about the issue:
https://streamable.com/lujely

Can someone help me, how can I fix this or did I do something wrong?

Debug.DrawRay function is a “debug” function and will display only in the editor view, not in the game view. You will need something else e.g. line renderer, if you want that to show a laser line in the game

Aaah, now it makes sense. So I have to find another way to make a laser for it.
Thank you for your answer, after I posted I was still looking for the problem in my code but looks like that’s not the issue.