Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

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:
    39,571
    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.