#error CS0246 The type or namespace name Monobehavior could not be found (are you missing a using

1 messages · Page 1 of 1 (latest)

lean lake
#

error CS0246: The type or namespace name 'Monobehavior' could not be found (are you missing a using directive or an assembly reference?) I get this error when trying to make a script for a player object

woven flame
#

Capital B

lean lake
#

I updated it to Capital B

spice heron
#

Behaviour

lean lake
#

Still

#

oh

spice heron
#

And configure your IDE

lean lake
#

Finally worked.

lean lake
#

I have done that hours ago

woven flame
#

Do you get auto completion when you type things?

lean lake
#

nope

#

I think it might be because of the VS version I have, I will update it

lean lake
#

Finally its updated but still doesn't have Intelesense

#

It doesn't give any suggestions

visual crypt
#

Let's do this

#

There are two sides to the config.
First you need to make sure you have the Game development with Unity workload installed

#

This is done by opening the Visual Studio Installer program, and hitting "Modify" on your VS install

#

Then you need to go to Unity and check the External Editor preferences, and make sure VS is selected here. Hit the "Regenerate Project Files" button, just in case.

#

Restart VS, and it should be done.

lean lake
#

Okay so I did all these rn and unfortunately it still didn't work 😐

#

As you see I modified it

#

and I regenerated Project files but.... 😐

visual crypt
#

Can you go to where the Unity project is on your filesystem, and check that there is a .sln and a .csproj file, along your Assets/, Library/, Logs/ folder?

#

Something like that

lean lake
#

Yea I do have all that you stataed

visual crypt
#

So try closing VS, then double-click the sln

lean lake
#

Then

#

?

visual crypt
#

VS should open and load correctly

#

You should have the scripts listed in your Solution Explorer window (on the right)

lean lake
#

Still doesn't give any suggestions

visual crypt
#

Yep that's not registering it. Close that, and open the .csproj instead

lean lake
#

For some reason I found a file named UpgradeLog.htm Which has this:

#

not sure if that can help or its normal...

visual crypt
#

Where did you find that, along the other files?

lean lake
visual crypt
#

From a quick search that can happen when you try to open the project on a different machine/location it was created on

#

csproj files store paths to resources, and it doesn't like being moved around

#

Can you open that file with any text editor?

#

Also, did it ever work before? And how did you install VS? Standalone or using the Unity Hub?

lean lake
lean lake
visual crypt
#

The UpgradeLog.htm?
No, the csproj
I install VS cuz I was coding python on it. I install Unity Hub yesterday so I am a beginner.
So the install was standalone. In Unity, see if you have the "Visual Studio Editor" package installed (Window > Package Manager). Normally it shouldn't be there

lean lake
lean lake
visual crypt
#

No, it was a request

#

Open that file with another text editor

lean lake
visual crypt
#

Click on that 3rd option, uncheck "always use this application to open this file type", and select Notepad for example

visual crypt
# lean lake

And that seems good, although the wrong package is displayed here. VS Code is not VS.
You want the last package in that list to be up-to-date

lean lake
visual crypt
#

404 for me

lean lake
#

bruh

#

for somereason its saying 404

visual crypt
#

Still 404 on that second one

lean lake
visual crypt
#

I'm going to download that and make a diff, hang on

lean lake
#

diff?

#

What is a diff

visual crypt
#

The difference between your file and a known good project file

lean lake
#

oh ok

visual crypt
#

Can you check that this file exists on your system?
C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\Managed\UnityEngine\UnityEngine.dll

#

Same for this one C:\Program Files\Unity\Hub\Editor\2020.3.26f1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll

lean lake
#

Yes they are there

visual crypt
#

Create a new Unity project, using the same Unity version. Create and open a script from Unity. If VS is not loaded, then I don't know what's happening. If it loads, your current project is corrupted

lean lake
#

Okay I will try that

#

Also what about this

#

What should I do with these 2

visual crypt
#

Make sure they're both up to date

lean lake
#

Oh okay

lean lake
#

It turned out to be corrupted

#

Thank you for helping

#

Thanks for the efforts and sorry for wasting your time

visual crypt
#

Oh you didn't waste my time

#

I learned that project files could be corrupted