Can't shoot my weapon

posted to: Using Iron Sights

Dear CgCookie


Hi! Today I was coding and for some reason even though I didn't change any code my weapon won't play the animation, show a bullet hole, or show a ray cast. In unity it shows the error the variable cam of shoot has not been assigned.

From Ivan.

  • Jonathan Gonzalez(jgonzalez) replied

    That means you're missing the camera in your script. That's used for the raycast to determine where you're actually shooting. You need to manually assign it to your script and/or you can modify your script to automatically assign it. 

  • Siarhei Kukresh(memesrnoice) replied

    Dear CgCookie,


    Thank you for your help.

    From Ivan