error CS0101: The namespace `global::' already contains a definition for `ActivateTrigger'

Simply put- Im very new to the whole scripting and unity engine, anyways Im trying to modify the original ActivateTrigger code so that when my first person controller enters a box collider, it should turn on a light (but for whatever reason, this original code is not working at all and i cannot find a solution.) I have followed all the instructions but for whatever reason the light is just not turning on or its not recognizing a collider/first person controller entering the trigger zone(the box collider), (honestly i have no idea at this point) And I realize i have more than one problem at the moment My question is

  1. I am getting the above error code CS0101 at 3,14 and I honestly have no clue what it means or to do.

  2. If anyone could possibly fix the last part of the script for me in a way so that as soon as the first person controller enters the zone, it will activate the trigger/light (or atleast if anyone can show me how) - (61,37): error CS8025: Parsing error

    using UnityEngine;

    public class ActivateTrigger : MonoBehaviour {
    public enum Mode {
    Trigger = 0, // Just broadcast the action on to the target
    Replace = 1, // replace target with source
    Activate = 2, // Activate the target GameObject
    Enable = 3, // Enable a component
    Animate = 4, // Start animation on target
    Deactivate= 5 // Decativate target GameObject
    }

    /// The action to accomplish
    public Mode action = Mode.Activate;
    
    /// The game object to affect. If none, the trigger work on this game object
    public Object target;
    public GameObject source;
    public int triggerCount = 1;///
    public bool repeatTrigger = false;
    
    void DoActivateTrigger () {
    	triggerCount--;
    
    	if (triggerCount == 0 || repeatTrigger) {
    		Object currentTarget = target != null ? target : gameObject;
    		Behaviour targetBehaviour = currentTarget as Behaviour;
    		GameObject targetGameObject = currentTarget as GameObject;
    		if (targetBehaviour != null)
    			targetGameObject = targetBehaviour.gameObject;
    	
    		switch (action) {
    			case Mode.Trigger:
    				targetGameObject.BroadcastMessage ("DoActivateTrigger");
    				break;
    			case Mode.Replace:
    				if (source != null) {
    					Object.Instantiate (source, targetGameObject.transform.position, targetGameObject.transform.rotation);
    					DestroyObject (targetGameObject);
    				}
    				break;
    			case Mode.Activate:
    				targetGameObject.SetActive(true);
    				break;
    			case Mode.Enable:
    				if (targetBehaviour != null)
    					targetBehaviour.enabled = true;
    				break;	
    			case Mode.Animate:
    				targetGameObject.animation.Play ();
    				break;	
    			case Mode.Deactivate:
    				targetGameObject.SetActive(false);
    				break;
    		}
    	}
    }
    
    void OnTriggerEnter (Trigger Collider) {
    	if(Trigger.gameObject.name == "First Person Controller"){
    	DoActivateTrigger ();
    

Apparently, you’ve forgot to close the curly braces in the OnTriggerEnter function:

void OnTriggerEnter (Trigger Collider) {
   if(Trigger.gameObject.name == "First Person Controller"){
       DoActivateTrigger ();
   }
}

About the global error: you can’t have two scripts with the same name in your project. If there is another ActivateTrigger script anywhere in Assets or any of its folders, delete, rename or move it outside Assets.

@aldonaletto I am doing the Roll a Ball tutorial and in it you create a script called Camera Controller and I got the ‘global::’ error. Referring to your answer, I found something called CameraController Import Settings and I can’t delete it. Besides this, there are no other files with the name ‘Camera Controller’ and the error is still there.