Unity script error message namespace MonoBehaviour not found - unity3d

I've been trying to write a script for my unity project, but the console gives the following error messages.
The type or namespace name 'MonoBehaviour' could not be found (are you missing a using directive or an assembly reference?
The type or namespace name 'Transform' could not be found (are you missing a using directive or an assembly reference?
Anyone got a clue?
https://i.stack.imgur.com/Ddy7J.png
https://i.stack.imgur.com/524pb.png

It's using.UnityEngine; small caps, the u in using is written in lowercase.

Related

what could this error mean (I am using Unity)?

I tried to download Cinemachine and got the error below so I removed it and then this error popped up again. Help :(
Assets\Samples\Cinemachine\2.8.9\Cinemachine Example Scenes\Shared\Scripts\InvokeEventFromInspector.cs(6,19): error CS0234: The type or namespace name 'Editor' does not exist in the namespace 'Cinemachine' (are you missing an assembly reference?)
Without having checked, but you can try removing the sample scene folder and see whether that solves it

when I import Mirror into unity I get this error: The type or namespace name 'ReadOnlySpan<>' could not be found

When I import mirror into unity im getting this error and I dont know how to fix it
Assets\Mirror\Runtime\NetworkReaderExtensions.cs(156,47): error CS0246: The type or namespace name 'ReadOnlySpan<>' could not be found (are you missing a using directive or an assembly reference?)
I had the same error, so I updated unity to the most recent LTS 2021.3.11f1 and that fixed it.

Mapbox not opening in unity?

I have the 2020.3.32f1 version of Unity and have tried to open Mapbox version 2.1.1 - the current one I am being told by the Mapbox website to download. It says I need Unity 2017 and higher so everything should be right, correct? Then why does it not load properly and I get the following errors:
Assets\GoogleARCore\SDK\Scripts\ARCoreBackgroundRenderer.cs(43,17): error CS0246: The type or namespace name 'ARBackgroundRenderer' could not be found (are you missing a using directive or an assembly reference?)
Assets\GoogleARCore\SDK\InstantPreview\Scripts\InstantPreviewManager.cs(32,23): error CS0234: The type or namespace name 'SpatialTracking' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\UnityARInterface\ARRemote\Scripts\ARRemoteEditorInterface.cs(40,17): error CS0246: The type or namespace name 'ARBackgroundRenderer' could not be found (are you missing a using directive or an assembly reference?)
Assets\UnityARInterface\Scripts\ARCoreInterface.cs(51,17): error CS0246: The type or namespace name 'ARBackgroundRenderer' could not be found (are you missing a using directive or an assembly reference?)
Assets\UnityARInterface\Scripts\ARKitInterface.cs(26,17): error CS0246: The type or namespace name 'ARBackgroundRenderer' could not be found (are you missing a using directive or an assembly reference?)
A polygon of Mesh 'cone' in Assets/Mapbox/Examples/2_AstronautGame/AstronautGame/Park/cone.FBX is self-intersecting and has been discarded.
Problem detected while importing the Prefab file: 'Assets/MapboxAR/Prefabs/AR.prefab'.
The file might be corrupt or have missing nested Prefabs. See details below.
Warnings:
Component at index 2 could not be loaded when loading game object 'ARCamera'. Removing it.
So yeah, no matter what I do, it won't load/open properly - the examples window from Mapbox doesn't open, nor does the Ampbox tab appear at the top of the Unity UI. It's really, really annoying, I can't even open the thing!!! I just need to get into it so I can start learning with the PocketDroid Go example if anyone knows that one... Please help it's been days and I am getting nowhere and it's literally step one: "open the package!" :(
Problem solved - Unity changed the name of ARBackgroundRenderer to ARCamera in like 2019 or something but Mapbox have never updated their SDK, hence the errors. If you use the April 2018 version of Unity, it works.
Have you tried using unity Unity 2017.1.0 instead of 2020.3.32f1? Their examples seem to be using that version of the editor.

When I build in Unity. I get an error called "error CS0246: The type or namespace name 'WebSocketSharp' could not be found"

Unity Version: 2019.4.9f1
Error:
Assets\Scripts\GirisEkranYoneticisi.cs(4,7): error CS0246: The type or namespace name 'WebSocketSharp' could not be found (are you missing a using directive or an assembly reference?)
https://prnt.sc/urzjh9
The issue is not in your code, its because mostly you are missing
websocket-sharp.dll
You need to download it and drop it into Asset/Plugins.
Hope this solves your issue

Am I doing something wrong with importing Oculus Integration in Unity?

When I go to the Asset Store in Unity and import the Oculus Integration I get 63 error messages.
I have tried re-installing Unity, it didn't work. I can't find anyone else having similar issues.
Error Messages:
Assets\Oculus\VR\Scripts\Util\OVRCursor.cs(22,19): error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?)
Assets\Oculus\VR\Scripts\Util\OVRInputModule.cs(25,35): error CS0246: The type or namespace name 'PointerInputModule' could not be found (are you missing a using directive or an assembly reference?)
Assets\Oculus\VR\Scripts\Util\OVRInputModule.cs(432,40): error CS0246: The type or namespace name 'MouseState' could not be found (are you missing a using directive or an assembly reference?)
There is many more like this, suggesting files are missing.
Unity Version 2019.3.0a3
Ok, this solves this problem, but either there is something wrong with Unity (tested 2019.2.0b4, 2019.1.4f1, and the 2019.3 versions) or Oculus Integration.
Add and a reference to Unity.ugui in Unity like in the picture.
I encountered a couple of compiler error as well, but those could just be commented as it was in sample code.
Make sure you run Unity Hub with administration rights and import Oculus Integration again
All VR components were renamed to XR.
Just double click on the errors and replace the lines of the Using statement with XR
e.g.
OVRTracker.cs
using VR = UnityEngine.VR;
// is changed to
using XR = UnityEngine.XR;
And the error will disappear.
I replaced VR with XR and it worked for everything except one boundary error.