Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
6
Question by SK0M0R0H · Feb 06, 2020 at 01:56 PM · visual studiocs0246cs0103

VS Code does not find some classes. cs0246/cs0103

Hello everyone! When I open Visual Studio Code, I get two error for some of my classes inherited from MonoBehaviour and ScriptableObject:
cs0246: The type or namespace name could not be found
For a static class:
cs0103:The name ____ does not exist in the current context.
If I open files with these classes and save them again (just "ctrl + s", nothing more), then the problems disappear. I can build the project even without resolving the problems. But if I close VS Code and open it again, I get these errors again.
All files are placed in the same folders as the files that do not arise any errors.

How can I fix it?

OS: Windows 10, 64bit
Visual Studio Code version: 1.41.1
C# extension version: 1.21.10 (C# for Visual Studio Code (powered by OmniSharp))
Unity version: 2019.3.0f6

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image RahulRaman · Feb 06, 2020 at 02:30 PM 0
Share

Do the errors appear in Unity Console window?

avatar image SK0M0R0H RahulRaman · Feb 06, 2020 at 02:37 PM 0
Share

No, only in VS Code console.

avatar image CrowbarSka RahulRaman · Jul 22, 2020 at 11:17 PM 0
Share

Hey I have this issue, but the errors appear in the console. Any idea how to fix it? I'm trying to reference a ScriptableObject in another Package using package dependencies, but the type is not found.

6 Replies

· Add your reply
  • Sort: 
avatar image
30
Best Answer

Answer by RahulRaman · Feb 06, 2020 at 02:51 PM

Try the following steps:-

  1. Open Unity

  2. Open Package Manager Window

  3. Check the version of your visual studio code package

If you are use package version 1.1.4 use the following steps to resolve the error:-

  1. In Unity, go to Window/Package Manager

  2. Search for your Visual Studio Code Editor package

  3. Downgrade to version 1.1.3

  4. Close Unity

  5. Delete your .csproj and .sln files in your project

  6. Open Unity

  7. Reopen VS Code and the errors are gone

Comment
Add comment · Show 8 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image SK0M0R0H · Feb 06, 2020 at 05:57 PM 1
Share

Thank you! It fixed the problem.

avatar image Akamis · Apr 14, 2020 at 05:39 PM 0
Share

Thanks ! The version 2.0.0 is available on beta and works as well

avatar image RudolfKorcsmarosDevelopment · Oct 28, 2020 at 01:50 PM 0
Share

Thank you! It fixed it.

avatar image marquizzo · Oct 30, 2020 at 04:16 AM 2
Share

This worked like a charm! Only thing I did differently was that instead of downgrading to 1.1.3, I upgraded to 1.2.3, which was released earlier this month... and it works. Thanks again!

avatar image LoneXUnity · Dec 21, 2020 at 09:52 AM 1
Share

worked for me too ! thank you

Show more comments
avatar image
4

Answer by stack86 · Oct 14, 2020 at 03:33 AM

I'm on Unity 2019.4.11f1 and package 1.2.2 and randomly had issues today where only one csproj was working at a time, anything from other namespaces from other csproj files were not being recognised. I followed these steps, downgraded and deleted the .sln and now it's working normally again. Thank you

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
3

Answer by MohammedOmarPF · Nov 24, 2020 at 10:05 PM

Awesome! Today November 24th, 2020 I had the same issue with Unity 2019.4.13 (LTS) and Visual Studio Code Package (v 1.2.2) Instead of downgrading to 1.1.3, there was an update for v 1.2.3

I followed the steps of upgrading the package, closing unity, deleting the sln and csproj, then openeing Unity and vscode and it WORKED!

Thanks a lot

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
3

Answer by ironWolf1990 · Nov 30, 2020 at 03:00 AM

OS : Ubuntu:20.04
>VSCode : 1.51.1
>Unity : 2019.4.15f1
> Visual Studio Code Package : v1.2.3

I had the same problem, I didn't downgrade the vscode package. Simply

  1. Close Unity

  2. Delete .sln and .csproj and close vscode

  3. Restart unity and regenerate project file by Edit -> Preferences -> External Tools -> Regenerate Project Files.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image djDavidj · Nov 09, 2021 at 11:48 PM 0
Share

This worked for me. Thank you.

avatar image
0

Answer by Beastman632 · Apr 23, 2020 at 06:24 PM

I also go this in the past and I'm now on 2019.3.10f1 and still got it. However if you just run and stop your project in unity and make sure all errors are resolved, the missing class imports in vs code will be fixed.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

146 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

hack and slash game errors 3 Answers

Compiler errors? 2 Answers

SocketIOEvent could not be found 0 Answers

VS2012 problems with Windows 8 and Unity 1 Answer

Unity Editor doesn't work anymore because of debugger Visual Studio 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges