Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

General problem with scripts: The associated script cannot be loaded

Discussion in 'Editor & General Support' started by Zape, Jun 12, 2013.

  1. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    I only started using started using scriptable Objects, and I am sporadically getting this error, it will sometimes break after a recompile sometimes get fixed, it happens so often that it makes it unusable I guess dont use it.
     
  2. SuperCrow2

    SuperCrow2

    Joined:
    Mar 8, 2018
    Posts:
    544
    Did anyone else have this problem? Once I backed up my game onto C-Drive from my flash drives, only the score on the C-Drive no longer works on certain levels, but works on other levels. The score works on all levels on my flash drives. The weird thing is, every other script works perfectly fine on each level on C-Drive, except the score on certain levels.

    Anyone know what could be the problem? The score always works on my flash drives as long as I never back up the flash drives from C-Drive.

    I tried so many different things but never got it working again. Even made a new scene and still didnt work
     
  3. aguiarbrunoa

    aguiarbrunoa

    Joined:
    Jun 11, 2020
    Posts:
    1
    This also happened to me and I FOUND THE SOLUTION!!!!!
    The problem was that some scripts were obsolete and so I had to open them and a box appeared to say to "renew" them and then I did that and in the unity project there was a box that I think said to make all scripts compatible, or something like that, I clicked on that and after a while it's already solved.
    The only down side is that I had to open all the scripts to find what was obsolete.
    Another thing that may be causing this problem is the "scripts" of the shaders that can also be obsolete.
     
  4. Zasox

    Zasox

    Joined:
    Nov 28, 2013
    Posts:
    1
    just enable for red error and delete problem source
     
  5. Racine-Z

    Racine-Z

    Joined:
    Dec 10, 2015
    Posts:
    4
    THANK YOU, i disabled the red error tab and dont see that there is a erro but now it's all right
     
  6. Firdavsbe

    Firdavsbe

    Joined:
    Jul 12, 2020
    Posts:
    2
    Man You helped me
     
  7. cheesline

    cheesline

    Joined:
    Jul 22, 2020
    Posts:
    2
    i have the same problem I wanted to ad a script to move my figure in my 2D game but it happened nothing and the console said there is something wrong but i checked everything
     
  8. cheesline

    cheesline

    Joined:
    Jul 22, 2020
    Posts:
    2
    my script doesn’t work in my 2D Projekt (I want to control the figure): using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour{ public CharacterController2D controller; public float runSpeed = 40f; float horizentalMove = 0f; void Update(){ horizontalMove = Input.GetAXisRaw("Horizontal") * runSpeed; } void FixedUpdata(){ controller.Move(horizontalMove * Time.fixedDeltaTime, false, false); } }
     
  9. CGCowboy

    CGCowboy

    Joined:
    Mar 7, 2018
    Posts:
    11
    This is what worked for me...

    I had hundreds of scripts that ALL had this error so I thought it was project-wide.

    Turns out: During refactoring on one script, I removed a public variable which was fine for that script (compiled successfully). However, I forgot about another script (GameManager) that was referencing that variable.

    For whatever reason, this made entire project fubar. Every script in my project had this error. But, when I removed the line that was referencing the public variable no longer there, everything was in order again. Took me forever to triage this.
     
  10. Freakhealer

    Freakhealer

    Joined:
    Aug 27, 2020
    Posts:
    1
    ALL HAIL ROGUE12
     
  11. Ferum1989

    Ferum1989

    Joined:
    Nov 3, 2013
    Posts:
    15
    I had this problem today. I just edited some script, changed some variable, saved it. I opened Unity and saw that all shaders in the project were broken! In a panic, I reloaded the project, Unity started recompiling a scripts, and when everything was over, absolutely all scripts showed the "Missing" status.

    This method saved me: I deleted all metafiles from the Assets folder and restarted the project. Unity recompiling everything again and everything is working fine!

    Unity 2019.1.11f1
     
  12. DevinW

    DevinW

    Joined:
    Jun 19, 2014
    Posts:
    31
    I fixed it by removing a #region of comments that was outside of the namespace and class. No clue why this would have any effect.

    Code (CSharp):
    1. namespace Example
    2. {
    3.       public class ExampleCase : ScriptableObject { }
    4. }
    5.  
    6. #region
    7. //my comments
    8. #endregion
    Edit*
    On 2020.1.6f1, I did a full reimport of project files - deleted all solution files - removed scripts folder - removed all metafiles in scripts - renamed script - renamed class - none of that fixed it. Moving the regioned comments around is the only thing.
     
    Michael_Berna likes this.
  13. slysman1

    slysman1

    Joined:
    Apr 11, 2015
    Posts:
    1
  14. MendesGabrieljr

    MendesGabrieljr

    Joined:
    Feb 27, 2021
    Posts:
    1
    Try to see if the file name matches public or class YourFileName: MonoBehaviour {
     
  15. t00t_Man

    t00t_Man

    Joined:
    Mar 18, 2021
    Posts:
    1
    thank you so much ill try this later but I hope this works
     
  16. BanditMann

    BanditMann

    Joined:
    Mar 31, 2021
    Posts:
    1
    just tried that and lost my progress.
     
  17. pedroharres

    pedroharres

    Joined:
    Sep 14, 2018
    Posts:
    4
    none of the above solutions was working for me. My project uses Unity Collab (which btw I don't recommend) but in this case was helpful. I pushed my last version from project to the collab cloud and then reversed my project to previous version. all scripts were working again . then I updated It to the last version and it worked fine.
     
unityunity