- Home /
why are "The associated scripts can not be loaded" errors seemingly being thrown at random for .asset files
HI , This error seems to occur at random . Once I create the asset ,everything is fine . Sometime when there is a assembly reload I get this error and sometime I don't get the error , heck sometimes i get the error then it goes away ... same thing whenever i close and restart Unity.
Here is my code for creating this asset where Comp is the Class which inherits from ScriptableObject
var asset = ScriptableObject.CreateInstance<Comp>();
AssetDatabase.CreateAsset(asset,"Assets/NewFolder/Comp.asset");
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
Check if the script name is the same as the Class that inherit from $$anonymous$$onoBehaviour. Reassign it to the inspector.
The Comp class was part of another script. I created a Comp.cs script and place the comp class in there.
It seems that not having the class name be the same as the script name will cause this problem.
Answer by DaiMangouDev · Jul 11, 2015 at 12:38 PM
The Comp class was part of another script. I created a new Comp.cs script and place the Comp class in it.
It seems that not having the class name be the same as the script name will cause this problem.
still true in unity 5.6; It was happening for me predictably, every time I restarted unity