- Home /
The namespace `global::' already contains a definition for `ShooterGameCamera'
error at line "public class ShooterGameCamera : MonoBehaviour {" this is upper part of script ShooterGameCamera.cs taken from 3rdpersonshooter unity demo game
using UnityEngine; using System.Collections;
// 3rd person game-like camera controller
// keeps camera behind the player and aimed at aiming point
public class ShooterGameCamera : MonoBehaviour {
public Transform player;
public Transform aimTarget;
public float smoothingTime = 0.5f;
public Vector3 pivotOffset = new Vector3(1.3f, 0.4f, 0.0f);
public Vector3 camOffset = new Vector3(0.0f, 0.7f, -2.4f);
public Vector3 closeOffset = new Vector3(0.35f, 1.7f, 0.0f);
public float horizontalAimingSpeed = 270f;
public float verticalAimingSpeed = 270f;
public float maxVerticalAngle = 80f;
public float minVerticalAngle = -80f;
public float mouseSensitivity = 0.1f;
public Texture reticle;
private float angleH = 0;
private float angleV = 0;
private Transform cam;
private float maxCamDist = 1;
private LayerMask mask;
private Vector3 smoothPlayerPos;
Answer by RalphTrickey · Jun 23, 2013 at 01:40 PM
It means exactly what it says. Somewhere in your source files (or a third party library) you have a class called ShooterGameCamera.
The simplest thing to do is to rename your class, although it may be worth finding out where else you have that class declared.
Answer by terresquall · Apr 19 at 08:23 AM
Or if you prefer to read, you can check out this article here, which goes through a few possible causes of the error and how to fix each of them: https://blog.terresquall.com/2021/10/the-global-namespace-already-contains-a-definition-for/
Your answer