I am working on my first Unity project and I am following the Unity Roll a Ball minigame tutorial. I just created my C# code in Visual Studio Code for the CameraController to set up a camera that would follow the player (the ball) around, however, when I enter play mode the camera does not seem to be set up correctly and two errors pop up.
Error 1: The referenced script (Unknown) on this Behaviour is missing!
Error 2: The referenced script on this Behaviour (Game Object ‘Main Camera’) is missing!
I have the Main Camera in my Hierarchy so I am unsure why the program is telling me it is missing. Could anyone point me in the right direction?
Thank you!
2
Answers
There used to be a script on the camera object that was renamed or deleted. Just right-click on the right side on the "(script)" part and select remove component. The warning should be gone.
In your Inspector on the right of the editor, there is a component that is missing a script. A common reason of this is, you downloaded a package where the script is not included. To solve this problem, you can just right click on the component (Script) and select Remove Component. How to Remove Component.. This should clear any warnings from the editor.