Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Compile console error?

Discussion in 'Scripting' started by MrPuppyy, Sep 17, 2020.

  1. MrPuppyy

    MrPuppyy

    Joined:
    Nov 4, 2019
    Posts:
    40
    I start up the game, i go to the object, and the scripts on it do not have the name on it like 'attack speed' or whatever instead its just called "Script". And the text says "The associated script cannot be loaded. Please fix any compile errors, and assign a valid script.

    Before this all happened, I made a new script on the object to make a new script for scaling. But alone with that error, that script says "Assets/TheScriptName The namespace '<global namespace>; already contains a definition for {TheScriptName}

    also had one that already deined start, and update (in console errors)
    i'm not really sure what i did lol any help would be greatly appreciated.
     
    Last edited: Sep 17, 2020
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,758
    This is pretty self-explanatory. Delete that new file and make a new one with a different name.
     
  3. MrPuppyy

    MrPuppyy

    Joined:
    Nov 4, 2019
    Posts:
    40
    why did this happen, tho?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    It happened because you already had a script with a class named TheScriptName and then you added another one with the same name. You either manually added it, made a copy of the same script in the Assets folder, made a script with the same name as a built in class or a class used in a Unity Package, or you're doing something really stupid like putting your project folder inside Dropbox ;)
     
    MrPuppyy likes this.