Unity displaying message "the associated script cannot be loaded" for all scripts when restarted - unity3d

I am following the Sebastian Lague procedural planet tutorial, and am on episode 3. Unity started refusing to refresh scripts and not showing any changes made, with no error messages. When I re-opened the project, all scripts displayed the message "The associated script cannot be loaded. Please fix any compile errors or assign a valid script." All scripts, when selected, show a message saying that they have "no MonoBehaviour Scripts" , even if they had. This problem persisted through:
Restarting Unity
creating a new project and adding the Tutorial's assets
Reimporting all
I could not find any fixes that worked on StackOverflow.
the Code is in the E02 folder on https://github.com/SebLague/Procedural-Planets.
This is my first time using unity, so I'm not sure whether the problem is with the code, something I've done on unity, or just a bug in the Unity software.

The error message says it all: "... Please fix any compile errors or assign a valid script."
Please check your console, maybe displaying errors is turned off

Related

Unity Error Occurred While Resolving Packages And Game Mode Doesn't Work Suddenly

I never ran into this problem before while building unity projects.
[1] Yesterday, I decided to update my unity hub to newer version, and now all of a sudden,
I keep getting this error and my packages are not loading into the editor workspace.
[2] Additionally, anytime I try and enter into game mode unity will suddenly stop and bounce me back to editor mode (never happened before). I am very lost why this is happening, and even my past projects that worked fine seem to be affected as well. Cannot run them within unity now. :(
All help is greatly appreciated!
-So far I have been just looking to make sure my unity apps are in the folder of that address - and they are, looking for direction.
It would be easier to help you if you include the exact error message in your question.
I assume it is this:
Cannot fetch authorization code. User access token is expired or invalid. You may need to sign out and sign in again. [Unknown].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
If so, log out in Hub and log in again. This happens either when updating Unity Hub or with bigger Windows updates for me.

Issue with errors in Unity on launch

I am having an issue in Unity where every time I launch the editor it asks me to enter in safe mode because there are a lot of errors and when I press ignore it launches and I can see in the console a lot of errors with the UI and I found out that I cant create UI elements directly in the hierarchy. I tried to update from 2020.3.13f1 to 2020.3.14f1 and for the first launch everything was fine, with no errors, and I could create UI elements but then when I restarted to make sure everything was actually fine, all the errors popped up again and I cant create UI. Why does this happen and does anyone have a fix because I can't find it anywhere online.
Try not to enter Safe Mode. Enter the editable project. There go to Assets-Reimport All.
It did it to me too, it's probably a Unity bug, this method fixes it. Practically it reimports the whole project by itself, avoiding that the bug gives you problems (such as those like UnityEngine.UI does not exist or Monobehavior does not exist, etc.)
Obviously you will not lose any assets and everything will be fine as before receiving the errors.
Have this issue with any template 2020+ versions
Always shows 2 empty errors on console at first run ,even on an empty project
Will try to install 2019 and hopefully work again
in my case some side app ran caused some error in the installation of Unity.
Nothing amid aboves helped.
Thus I decided to fully reinstall it from scratch to default one.
Now it worksok. But before that . To wipe out the Unity thorowly you need in:
uninstalling Unity and UnityHub in windows' settings
remove all related/remained folders in "C:\Program Files"
remove related/remained folders in "C:\Users\myname\AppData\Local "
in Register Editor go to clean unity like folders in "Computer\HKEY_CURRENT_USER\SOFTWARE"
optionally, remove sample projects in "C:\Users\myname"
You're very likely simply opening the wrong folder, it's a common mistake
Or, you have possibly moved around the folders that you cannot move
Also - it's a nuisance but it's best to install the "hub"

Very unusual error that I have never seen. UNITY

Im getting this weird error that I have never seen before and i have like 400 of them and they i think are all different. Here is an example Library\PackageCache\com.unity.test-framework#1.1.20\UnityEngine.TestRunner\NUnitExtensions\Runner\UnityTestExecutionContext.cs(125,34). This also happened right after my pc shorted out. I fixed it loaded up unity and all my files were gone. I was planning on trying to redo some of my stuff when this came up. I'm also having a warning about a meta data file existing but its packages cant be found. I don't know if these are connected or not. This is also a brand new project so its not anything old.
Answer: Go to your library and you will find all your projects and such there. If you locate to the project you are currently working on find a folder called package cache. Delete this and you will have no more errors!

I get MDB_MAP_RESIZED error in Unity, how can I fix it?

Excuse me if this has been posted before, but I can't find a solution that works for me.
When I run a little 2D-game I'm working on in Unity I get following errors:
> Assertion failed on expression: 'm_ErrorCode == MDB_MAP_RESIZED || !HasAbortingErrors()
> Artifact meta info not present for hash 306bf9d63d75727c0b63ec8f203f76ac
> Asset database transaction committed twice!
> Assertion failed on expression: 'errors == MDB_SUCCESS || errors == MDB_NOTFOUND'
Despite that everything in the game seems to be running correctly, but the error keeps popping up.
Somebody suggested that it might have to do with the imported sprites, but all my sprites are PNG, which should be standard for Unity? Reimporting the sprites didn't seem to affect the error.
What could be causing the error? How can I identify it and fix it?
Check to make sure you have an active Licence in your Unity hub, if not sign up for one , they are free.
I've also just had this error -
saved and closed unity Editor
opened up hub checked for valid license
there was a hub update.- did that.
reopened Unity editor no more error.
May have just needed a restart after being open for 4 days - more likely the hub update wasn't telling the editor it was licenced properly.
Had this issue early into my development, I just reset my unity after saving and checked for updates in my license.

Unity built-in Packages Compiler Errors

I just started learning how to use Unity to make a simple 3D game.
It's working fine when it comes to creating the environment, but once I imported the built-in Character package it gave me a compiler error and wouldn't run (All compiler errors have to be fixed before you can enter playmode!).
Removing the imported package removes the error and it can run, I tried using other built-in packages like 2D or Cameras but same problem occurred.
After adding 2D package, here's the console (error with no text):
After adding a character from the package, here's what the Inspector says (the associated script cannot be loaded. please fix all compiler errors and assign a valid script):
As shown in the pictures I'm using unity 5.6.0f3 64-bit.
I tried uninstalling and re-downloading it again but that didn't work.
I tried creating a new empty project, import a package and hit run, still didn't work.
A working solution from this post.
Hi, I reported this as a bug and I just got the response from Unity today. Try changing system locale to not Arabic. Go to Control Panel > Change date, time or number format> Administrative tab> Change system locale
Check if the script file name is the same as the class name in the file? They should be the same.
UPDATE
See this part of the picture.
No Monobehaviour scripts in the file, or the names do not match the file name.
And from here,
MonoBehaviours inside namespaces break, if they have a method with a default parameter (such as public void Foo(bool bar=true)).
See also here.
And it seems an identical issue of Compile Error with empty message.
Solution from the post:
Could get a Error message on another computer and it's the same as
mentioned in this Thread:
Creating managed DLL for Unity fails with error when importing into Unity
Which lead to this:
http://forum.unity3d.com/threads/5-2-1p3-mono-cecil-assemblyresolutionexception-unityengine-ui-dll.361666/
I could actually solve it with manually deleting all remains of Unity
and Monodevelop after the deinstallation (ex.
C:\Users[YourUserName]\AppData\Local etc. ) and then reinstalling
5.2.3f.