Question by 
               inaudiblefuzz · Feb 01, 2020 at 10:53 PM · 
                shootingdebug.logdebug.drawline  
              
 
              Debug.Log not showing in the console
I'm working on a RayCast weapon. My Debug.Log isn't showing up in the Console.
 using UnityEngine;
 
 public class Gun : MonoBehaviour
 {
 
     public float damage = 10f;
     public float range = 100f;
     public Camera fpsCam;
 
 
     // Start is called before the first frame update
     void Start()
     {
 
 
         if (Input.GetButtonDown("Fire1"))
         {
             Shoot();
         }
     }
 
 
     void Shoot()
     {
         RaycastHit hit;
         if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
 
         {
             Debug.Log(hit.transform.name);
 
         }
 
 
     }
 
 }
 
 
              
               Comment
              
 
               
              Answer by DreivanBG · Feb 02, 2020 at 12:58 AM
Hi, if you want try this:
     // cast Ray from the center of the screen
     Ray rayOrigin = Camera.main.ScreenPointToRay(new Vector3 (Screen.width / 2, Screen.height / 2, 0));
     RaycastHit hit;
     
     if (Physics.Raycast(rayOrigin, out hit))
             {
                 Debug.Log(hit);                   
             }
 
               Don't forget that your target needs to have collider or there will be no log message.
Your answer
 
             Follow this Question
Related Questions
How To Keep My Weapon With My Camera? 2 Answers
My gun is only shooting bullets every 8th shot..? 0 Answers
2D collider is not working on instantiated gameobjects. 0 Answers
How to make player shoot by touching a shoot icon image in unity. 1 Answer
Trying to have bullets travel in the direction the player is facing 0 Answers