DrawRay not drawing a ray

Hi,

When my character lands on a bomb trap I want a ray to be cast to assess the objects around the character which will determine how and where he is flung. I am trying to use Debug.DrawRay in order to make sure I’m casting the ray correctly, but nothing appears to be happening. I’m not getting any errors.

When my character lands on the bomb trap the following function is triggered. The Vector3 “bombForceDir” is a random direction determined in another function. For the sake of this example lets assume its (1,0,0).

public void PlayerExpload (Vector3 bombForceDir)
	{
		if (Physics.Raycast (transform.position, bombForceDir, 2)) 
		{
			Debug.DrawRay (transform.position, bombForceDir, Color.green, 5);
		}
	}

Thank you for any help!

This will draw in the scene view tab only. Or you can enable gizmo drawing in the game view to see it there too. There’s a little gizmos button at the top of the game view. This is in the scripting API documentation.