I was following this tutorial https://www.youtube.com/watch?v=8VVgIjWBXks
about making a multiplayer game in unity using Mirror https://assetstore.unity.com/packages/tools/network/mirror-129321.
So obviously I went to the asset store and imported it... (I'm using unity 2020.1)
But now it's throwing a ton of errors and not letting me use "using Mirror;"
VSCode says: The type or namespace name 'Mirror' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]
Interestingly enough I can run the game without any issues even with all the errors but when I try in my code to "using Mirror;" it doesn't work
I tried reimporting and restarting the project, regenerating .csproj files, and even trying on different unity versions but nothing worked. I'm assuming that the Mirror package itself is totally fine but I'm doing something stupid....
Any idea what I could do?
This seems to be the problem:
Most likely the version of VS Code you have installed, reverting VS Code C# Extension from 1.23 to 1.22.
The short term fix involves literally deleting Mirror from Unity and re-importing it from the Package Manager. Also deleting *.vscode and *.SLN files.
A proper discussion about this issue is found at Omnisharp-vscode GitHub page.
I had to ensure player settings had scripting define symbols:
MIRROR
MIRROR_17_0_OR_NEWER
Related
I pretty much looked everywhere... but couldn't find anything that could debug my problem.
The only thing I do in a script is "using UniRx" to have the following error : The type or namespace name 'UniRx' could not be found.
What i tried:
On Unity, downloading from Package Manager with "Add Package with git URL"
On Unity, downloading from Package Manager with the normal way: Download -> import (into folder Plugins)
On each part, i also tried:
"Reimport All"
Closing and opening back Unity Hub then Unity
I found nothing much on google except for having this problem only on Visual Studio (which is not my actually problem since Unity itself doesn't accept UniRx)
But those who have that problem, i read that you need to "Assets" -> "Open C# Project"
Can anyone help me with my problem on Unity ? Searched for hours but still stuck :(
Unity Version: 2021.3.3f1
Well seems like my problem was like fafase said... I totally forgot about assemblies since i don't use Unity much and since it's been a long time i didn't continue my project.
I'm trying to use ClearScript in Unity, but fail because Unity does not see the DLL.
To be sure, I cloned the project and had the DLLs built. I did this using the instructions from ClearScript.
The goal is to use the DLL on HoloLens, which in turn means I have UWP as the platform and ARM64 as the architecture.
But I also want to have valid references during the implementation in Unity and not have constantly grayed out code because of the scripting symbols (such as UNITY_WSA).
So what did I do?
Screenshot - I took the dlls out of the output-net4.5-folder and set the api compatibility level in unity to .NET 4.x. The red ones are the dlls that I need and the blue ones only if I realy need to use V8, like already mentioned by the instruction from ClearScript.
All the dlls, except "..win-x64|86.dll", are managed dlls and should work out of the box in unity. So this are the import settings for the managed dlls and the settings for the unmanaged|native dlls.
So what did I miss or what did I do wrong? I used in the past for example another javascript interpreter, called Jint, where I also just took the managed dll out of the .net-4.5-build folder, imported it under Assets/Plugins/Jint and used it in my code just by adding the using in my classes.
I'm not sure if I should actually be happy or sad. Unity does what it feels like doing. The whole time (2 days) it didn't want to load the DLL for me. Just now I opened Unity for the 30th time and suddenly Unity recognized the DLL and listed it under references in the vs-unity-project.
So I doubted whether Unity, after making changes in Unity, actually reassembles the VS project.What did I do to confirm the guess and what do you need to do to solve the problem? I added a new DLL, this of course was not seen by unity and not referenced in the vs-unity-project. Then I deleted the solution file and the C# project file from the Unity project and restarted Unity. And when I reopened the VS Unity project (by opening a c# script), all the DLLs including the new DLL were suddenly referenced and the usings worked!
I run into this problem every few months and it annoys the crap out of me. I do not understand what causes this or how I seem to keep fixing it. But every once and awhile I will update Unity, switch git branches or something and then all of a sudden Unity can not find packages imported from GitHub.
I can see that the libraries are in my unity packages folder but Unity can not see them. Here you can see MyBox and xNode are in my Unity Packages folder.
The funny thing about the error, highlighted below, is that the line of code it is complaining about possibly not having a using directive for xNodeEditor... is a using directive for xNodeEditor...
Here is the error I am getting for that line. "Assets\Editor\xNode\DialogueNodeEditor.cs(2,7): error CS0246: The type or namespace name 'XNodeEditor' could not be found (are you missing a using directive or an assembly reference?)"
I don't think this is a namespace issue as I don't use namespaces. I am sorry I can't provide more information I do not know what I did recently to my project before this started again.
Not sure if this is relevant but here is my GameAssembly where you can see MyBox and xNode are present.
As I stated in the comments, closing Unity before switching branches seems to help minimise how much Unity freaks out.
After, if VS is no longer recognising libraries in your code / Unity's built in scripts it may have to do with not opening the SLN file.
Here is a part of a tutorial I wrote as this problem occurred on the school computers.
If VS says "Miscellaneous Files" just under the scripts name tabs it has not properly opened the Unity files. Fix this by closing VS and opening by clicking in Unity "Assets" then "Open C# Project" it may prompt you to specify a SLN file.
Even if VS does not say the files are misc it seems to help to open via assets rather than double clicking a script.
I am getting this error
Assembly ‘Library/ScriptAssemblies/Assembly-CSharp-Editor.dll’ will not be loaded due to errors: Reference has errors ‘Google.GData.Client’.
Our project was running on Unity 2018.1, and I am testing it on 2018.3.5f1. After doing some adjustments for the upgrade, I noticed that some of our custom MenuItem went missing and guessed that it's probably because of this error.
I have been searching about this since yesterday but had no luck finding the right solution. Any help is appreciated greatly.
Got it! I found some old libraries that are not used by our project anymore. In Unity 2018.3.x, .NET 3.5 is label as deprecated. For those who may encounter the same problems do the following:
Look for .dll files that targets .NET 3.5.
Either delete them, or update them.
Reopen Unity
I'm getting an error CS0246 saying the file 'BaseMeshEffect' could not be found. But the same project in my colleagues computers work fine. Where can I find this file?
Assets/_UI/Packages/Gamestrap UI/Effects/ShadowEffect.cs(11,33): error CS0246: The type or namespace name `BaseMeshEffect' could not be found. Are you missing a using directive or an assembly reference?
Thanks
It sounds like you're using a different version of Unity than your colleagues. Update to Unity 5.2.
Reference
Hey I just found this thread, I'm one of the creator of Gamestrap UI and I saw you were having an issue with it, Unity upgraded it's version and changed a lot of stuff in the effects section, I've already uploaded a new version of the asset so it can work with the 5.2 version and the older versions as well, you just have to redownload the asset and it should work. Hope you are liking Gamestrap!