TextMeshPro can not be resolved as a class in visual studio - c#

I start to use TextMesh Pro in unity3D 2018 to render text and it works well when I set it up in inspector. But by the time I try to reference it in the script in visual studio 2017, I find the vs always warn me there is no such a class. Could anyone give me a suggestion?

You should upgrade Unity to the latest version. It appears there is a problem with TMPro.
An issue related to this has been discussed on the Unity Forum

I'm not sure, but I think you need to use the namespace from text mesh pro "using TMPro" and variables look like this "public TextMeshProUGUI aTextMeshProField;"

I had the same issue, and none of the following worked for me: updating Visual Studio 2019 through Visual Studio Installer, updating to latest Unity LTS 2020.3 and the visual studio editor package on Unity Package Manager.
Then I saw there were issues reported years ago regarding namespaces and packages here, to I went to Unity > Edit > Preferences > External Tools and I unticked "Generate .csproj files for Registry Packages", and that did the trick for me.

Related

Unity referances not working Visual Studio 2022

As seen in the image bellow, references are not showing up in visual studio.
I was just using visual studio and i closed the project opened some other project and opened the unity project again in visual studio.
But then none of the references shows up and i cant really fix it.
Any ideas on how to fix this?
In Unity Editor try:
Edit -> Preferences... -> External Tools -> Regenerate project files
This problem happened to me, I couldn't solve it, I reinstalled visual again and downloaded c# plugins and module so it worked
The code pair may not be able to compile due to not referencing the relevant library files and namespaces

Autocomplete not working for VSCode with Unity

The question is as title says.
My settings:
Unity version: 2020.3.24f1 (it's the LTS)
VSCode version: 1.63.0
I got some extensions for VS Code: C#, VS IntelliCode (don't think this matters)
Things that I've done:
https://forum.unity.com/threads/cant-get-vscode-to-work-properly-with-unity.538224/
https://forum.unity.com/threads/intellisense-not-working-for-visual-studio-code.812040/
Unity VSCode autocomplete Intellisense not working
Installation issue with Visual Studio using Unity
How to get Visual Studio to recommend unity codes
Unity Scripts edited in Visual studio don't provide autocomplete
VSCode with unity c# autocomplete problem
Unity VSCode Intellisense not working in 2020 version
TL;DR -
I've set Visual Studio Code as my external script editor, tried downloading mono editor + gtk thing, snippet tool is NOT what I want, restarted my computer, and few more that I can't even remember.
Please don't recommend other editors than VS Code because I see so many thread pointing to VS Community 2019 and I just can't see how VS Community solution is relevant to VS Code.
I had the same issue and I solved it randomly so I will tell you the things I tried:
uncheck all options in unity>edit>preferences>external editor>generate .csharp. I checked all of them because a youtuber told me but then I saw that input system and cinemachine namespaces won't work so I unchecked them, now it works, it also helped on autocomplete.
download unitydev extension package from VS Code extensions, this package has all the needed documents and snippets and autocomplete assets.
try to regenerate files and reset argument, change editor to something else and see if it won't work there too!
most important: downgrade vscodes pakcage in unity package manager. I think I used 1.2.0 and it worked.

Unity VSCode Intellisense not working in 2020 version

I am new to unity and have recently started scripting, I noticed that my vscode 2020 doesn't autocomplete my c# scripts.
I have the c# extension installed
I have "Visual Studio Code" selected in the preferences in unity
I tried a bunch of different extensions
I tried to Regenerate Project Files With Different Checkbox Selected
but nothing works.
Then I downloaded 2019 version of vscode. Surprisingly, intellisense is working in vscode 2019, however it isn't in 2020.
What shall I do?
Any help will be appreciated.
If you want to use Visual Studio with maximum compatibility with Unity, install through the Unity Hub. (open the Unity Hub, go to the installations, three points, add modules, click on Visual Studio Community 2019 and install it)
It will install Visual Studio Community 2019 with its Unity package, also in the project's Package Manager you can download, if it is not already installed, the support package that Unity (Visual Studio Editor) updates regularly, and which guarantees compatibility with Unity.
If you want to use only Visual Studio Code instead, I don't know what to say, not being installable through Unity Hub I think the support is less, you can still try to install the package (Visual Studio Code Editor) in the package manager and see if it solves the problem.

UnityProject\Packages\com.unity.test-framework\UnityEngine.TestRunner\Files could not be found

I've just downloaded and installed the newest version of Unity (2019.2.3f1) and integrated my Visual Studio into the project for script editing. However I can't attach any scripts to Unity because of the title error. Do I need to perform some additional setup or include extra dependencies to get this working?
Thanks
This is a hard to pin down bug, but in general, people have seen success when they update to a more recent version of Visual Studio.
Update to a newer version of VS 2017 or update to a recent version of VS 2019.

Unity solution not compatible with visual studio

Since updating to the most recent version of Unity 5.4.0f3, whenever I doubleclick on a script, it launches both Visual Studio and Monodevelop, but I get an error saying that the this version of VS (Community 2015) is unable to open my project. Monodevelop displays it's own, somewhat less clear error message. Please see the screen shots below.
I can still manually open my script using Visual Studio's file menu, but the intellisense code completion no longer works. Anyone know how to fix this? I have Visual Studio's Tools for Unity installed.
I was having similar issues when doing a clean download of an existing Unity project onto a fresh install of Visual Studio Community 2019.
In the end the issue for me was that, although the correct version of VS Tools for Unity was installed, it was 'Disabled' by default in VS's Manage Extensions dialog (Extensions -> Manage Extensions). Just had to click 'Enable', restart Visual Studio, and all worked as expected again.
Turns out it was an issue with my existing install of Visual Studio Tools for Unity (VSTU).
I found a thread where users had experienced similar problems due to an unsupported version of VSTU running on Unity5.2 and beyond. Unity 5.2+ requires VSTU 2.1 or later for VS to work correctly with Unity, more information for anyone interested is available in the documentation here.
I had VSTU 2.3 installed, but removing and reinstalling VSTU resolved the issue, so there must have been a problem with my install. If anyone else has this or a similar issue you can download the latest installer for VSTU here. Thanks to all who chimed in your responses helped me look in the right place!
Please try following steps:
Delete old *.csproj and *.sln files on project's root folder
Check "Edit > Preferences > External Tools" and make sure you've selected "Visual Studio"
Re-open solution by "Assets > Open C# Project" menu
For me it was enough to right click the solution in Solution Explorer and run "Resolve errors".
I will complete what is said above. I experienced this issue today and it took me a while. In my case it was relative to a new install of the Unity Editor.
For some unknown reason the unity tool used on VS (intellisense) was uninstalled. I had to reinstall this : open Visual Studio Installer, select your project and reach the Gaming section where reside the tool for Unity.
The extension "Visual Studio 2019 Tools for Unity" seems no longer available for download via the extension manager. Luckily I recalled that I saw some game development features in the Visual Studio installer, so I picked that one:
It works for VS 2019 (16.11.11) and VS 2022 (17.2.0 Preview 1).

Categories

Resources