'Why does Debug DrawRay not draw the Ray I'm Expecting?

So i saw a few tutorials and wrote a similar code but i cant get the raycast to work for me. I need the raycast to see if my char is grounded to enable the jump. Here is the program:

private bool isGrounded()
{
    float extraHeightText = .01f;
    RaycastHit2D raycastHit = Physics2D.Raycast(GetComponent<Collider2D>().bounds.center, Vector2.down, GetComponent<Collider2D>().bounds.extents.y + extraHeightText);
    Color rayColor;
    if (raycastHit.collider != null)
    {
        rayColor = Color.green;
    } 
    else
    {
        rayColor = Color.red;
    }
    Debug.DrawRay(GetComponent<Collider2D>().bounds.center, Vector2.down * (GetComponent<Collider2D>().bounds.extents.y + extraHeightText));
    return raycastHit.collider != null;
}


Solution 1:[1]

Debug.DrawRay will only draw using gizmos. These are enabled in the "Scene" view by default and disabled in the "Game" view by default. The documentation states:

The line will be drawn in the Scene view of the editor. If gizmo drawing is enabled in the game view, the line will also be drawn there.

If it's drawing in neither view, make sure your function is being called from somewhere. You might also need to enable the particular script's gizmos in the drop-down menu. Also, keep in mind this feature will never work in a Standalone build of the game; Debug.DrawRay only functions in the Editor.

I'll also note that the "extra height" value of 0.01f is exceptionally small.

Gizmos Disabled: Gizmos Disabled Gizmos Enabled: Gizmos Enabled

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Foggzie