enter image description here
I am trying to release a game for Android, but I am getting these errors. I would be very happy if you can help me resolve these.
This is my full method of fixing these errors as they are very common for me and many other people.
This did come from my solution in Unity Forums (here’s the link): https://forum.unity.com/threads/man-its-a-hell-in-building-android-unity-2020-3-19f1.1209706/#post-8187237
But here’s the main fix:
Firstly uninstall and re-install the current unity editor completely by deleting it from ProgramFiles/Unity/Hub/Editor/YOUR_EDITOR_VERSION. Next I re-installed the same editor (MAKE SURE YOU SELECT ANDROID SDK, NDK AND JDK). Then delete your .gradle folder in Users/YOUR_NAME. I then deleted my Plugins folder in the assets of my project. Finally set JAVA_HOME variable to your unity editor OpenJDK location like this: ProgramFiles/Unity/Hub/Editor/YOUR_EDITOR_VERSION/Editor/Data/PlaybackEngines/AndroidPlayer/OpenJDK
After that restart your PC and run unity and when you build there should be no errors!
Related
I recently got a new computer, and finally got around to installing MonoGame, as I worked with it a few months back on my old computer, and primarily use Unity for my game development when not working on 2D games. Their website says they have CLI templates that work with Rider, but I figured it would be best to get it installed with Visual Studio first. Following the exact steps listed on the MonoGame website, I got everything installed that I needed, and started a project from one of the Visual Studio MonoGame templates. Upon opening the project, and everything finishing loading, I am greeted to this miserable sight. I also had an error in the console relating to MonoGame, with the error code MSB3073. From what research I did, I found that it either had to do with my username having a space in it (it clearly does not, so that was out of the picture), or it had to do with using the Visual Studio templates, and I would simply need to create the project from the CLI templates, as seen here. However, creating a new project from the CLI templates does not change anything. I have tried uninstalling and reinstalling dotnet, I have tried uninstalling and reinstalling Visual Studio. I have, of course, powered my computer off and back on multiple times. Even trying to open the project in Rider after installing the proper MonoGame packages in the program has the same exact errors. But when I zipped the project up and sent it to a friend who works with MonoGame, he was able to run the project with no issues, so clearly it has something to do with my setup.
I have also cleaned my nuget cache, cleared my project temp folders, and cleared the visual studio cache. Eventually, the Microsoft dependencies stop having issues when I simply close and open the project again, but every time I open the project in Visual Studio, I get the same error in the console, and it prevents me from running/building the project.
Hoping someone on here will know what to do with the info I've given, as I'm completely out of ideas!
So I figured it out. I'm not very experienced with the command line, but I managed to find a very nice tutorial by someone who wanted to make games with MonoGame using only the command line. In it, I was able to attempt to build the project from the CLI, and it gave me an error message unlike what was in Visual Studio. It said that MonoGame only works on a 64bit OS, but I'm on a 64bit OS. So I went to look at what version of dotnet was being used, and sure enough, it was the 32 bit version! It took a while to figure out how to uninstall it, and how to use the dotnet-core-uninstaller tool in the command line. Then all I had to do was remove the Environment Variable in the System category for the Path variable that referenced the Program Files (x86) directory of dotnet.
Hopefully if anybody else comes across this issue, they'll find this post, as none of the others seemed to fully explain how to do anything that needed to be done to fix the problem :)
I recently upgraded to Unity 2019.3.0f6. When I opened one of my c# files, I noticed that UnityEngine.UI wasn't being recognized as a valid namespace. This caused me to get red squiggles whenever I referenced this namespace. IntelliSense also stopped working. This problem only shows up in VSCode, my project still runs just fine in Unity.
I checked the Omnisharp logs and found some errors that tell me Omnisharp is unable to find the UI .csproj file and a couple others.
[warn]: OmniSharp.MSBuild.ProjectLoader
The referenced project 'UnityEngine.UI.csproj' does not exist.
What would cause this?
Things I've already tried:
Checking that the dotnet command works
Re-installing the c# vscode plugin
Deleting the .sln and .csproj files and letting Unity regenerate them
Re-installing Unity
It is a bug in version 1.1.4 of Visual Studio Code Editor package.
These are the steps that I did to fix this issue:
Open Window > Package Manager in Unity Editor
Select Visual Studio Code Editor and click Remove
Select "See all versions" under Visual Studio Code Editor
Select version 1.1.3 and click Install
Restart VS Code
There is a forum discussion on this here
And the actual issue is being worked on Unity Issue Tracker ticket here
UPDATE:
The current Visual Studio Code Editor package version 1.2.1 does not have this bug.
There is Assembly-CSharp.csproj file at the root of Unity project. I added this to fix error:
<Reference Include="UnityEngine.UI">
<HintPath>Library/ScriptAssemblies/UnityEngine.UI.dll</HintPath>
</Reference>
In newer Versions of Unity this might still happen to you, and you may try these answers, but first make sure you have activated "Embedded Packages" and "Local Packages" at least in the Project settings if using VSCode and regenerate them; at least for me it made the errors due to missing Assemblies go away. Maybe for other issues you can try ticking others as well.
Of course my assemblies are set up correctly in Unity to reference each other. Just wanted to add this for those who maybe overlook that setting in search for a solution (I am pretty sure the original author already did this, but I see a few comments that hint me, that not everyone tried that first)
Enabled Sections in the Setup:
I'm having the exact same problem today. Didn't change anything. It just broke. I think the C# plugin in VSCode needs updated but I can't be sure. I'm fairly new to Unity but that seems to be the case. In the mean time I switched to VS2019 and it seems to be working. But I much prefer VSCode so I am looking for a solution too.
VSCode on a Mac. Problems with Omnisharp not loading.
YouTube user Axiom. He explains how to fix Omnisharp loading. After I followed his video, It fixed my loading problem.
The Fix.
On your C# exstions under the gear pick "Extension Settings" then in the search bar add "useGlobalMono" - Under Use Global Mono - change "auto" to "always" and restart Omnisharp.
Video Reference - https://youtu.be/KJYrRv9cShY
I have installed Hololens Emulator, Visual studio 2017, and Unity 3D and done all the necessary settings.
Now I want to run my Unity project on Hololens Emulator, but unfortunately when I am running the .sln generated file in Visual Studio, I am facing this error:
Error CS2001 Source file 'C:\Users\Admin\Documents\MyHololens01\Packages\com.unity.textmeshpro\Scripts\Runtime\TMP_FontAsset.cs' could not be found
How can I solve this problem?
I encountered the same issue. I am not sure which unity version are you using, but this is what I did to resolve my error (assuming you are using Unity 2018.2.12f1 or 2018.2.11f1):
(1) Uninstall TextMesh Pro
Open your Unity project.
Click on Windows from the Unity Menu
Select Package Manager
Find TextMesh Pro package and select it
Click on Remove located on the top right corner
Screenshot here to help you. I already uninstalled mine, so you should see Remove instead of Install
(2) You must delete the previously generated UWP Visual Studio Solution in your previous build.
(3) Build your project in Unity
(4) If using older version of Unity:
If you see a folder named TextMesh Pro inside your Asset folder, delete it and then follow the steps above to rebuild it. Make sure you delete the previously generated UWP solution.
Hopefully this resolve your issue.
I just heard that Unity will be dropping support on MonoDevelop on its 2018.1 version and went to search for an alternative. VSCode was the best option so I downloaded it and installed all suggested Unity extensions. (https://code.visualstudio.com/docs/other/unity)
I also changed my External Script Editor to Code. I've created a new Unity project for testing. The code snippets are working great for unity methods such as Start () and Update () but whenever I try to declare a variable like:
private Rigidbody rb;
The rigid body is not suggested. I decided to test with other data types, the most essentials like int, float, etc. And none of them are suggested either. What could be happening? Why is IntelliSense not working properly? I've already downloaded the C# extension as suggested at https://code.visualstudio.com/docs/editor/intellisense
I'm on a Mac using MacOS Sierra with the most current version of VSCode and Unity 2017.1.
[EDIT] The problem was solved after I reinstalled, MonoDevelop, VisualStudio for Mac, VSCode and all it's extensions and used mad.meesh suggestion of searching the .sln on project opening. I still don't understand why, but it's working.
Old question, but I had the same problem just recently.
There must have been an issue in your Assembly-CSharp.csproj or project-name.sln files. Most likely to be the .csproj file. If you take a look at it, you will see various references to .dll files.
You can tell Unity (my version: v2019.2.20f1) to create these for you by enabling Edit > Preferences > Generate all .csproj files.
Delete both files.
Enable .csproj file generation.
Double click on a script in Unity.
This fixed my issue.
I followed the tutorial from Microsoft for VS Code with Unity and it seemed to finally do the trick... https://code.visualstudio.com/docs/other/unity
Steps I took:
Installed https://dotnet.microsoft.com/download
Installed https://www.mono-project.com/download/stable/
Installed C# extension in VS Code.
Unity > Preferences (cmd + , on Mac) > External Tools (left toolbar) > External Script Editor > Visual Studio Code.
Then this is the trick I found to work after doing all of this... I open up VS Code prior to starting my Unity Project and manually go into the Unity Project folder and open up everything in VS Code FIRST. Then, with that project already open and working in VS Code with Intellisense, I double click the script in Unity and it will open it up in the already opened VS Code editor and have Intellisense already working! Do my normal workflow for the day and close everything down... then when I start up the next time, just be sure to open the project in VS Code FIRST and then VS Code will recognize it's a C# project and initiate Intellisense and all that jazz.
Hope this helps!
When I double click a script monodevelop isn't opening, but I can open monodevelop separately and then load projectname.sln file and it syncs ok. I can also call external editor, but I'd like to use monodevelop for code completion. Anyone managed to get this working?
I have mono-4.0.3-gtksharp-2.12.26-win32-0.msi and
gtk-sharp-2.12.26.msi installed, and I am using
Windows 7.
Maybe, Monodevelop is not associated with Unity. Go under Edit -> Preferences -> External Tools and see if Monodevelop is selected as external script editor.
I've had a problem very similar to yours and what I did to fix this was I downloaded the needed GTK# file from the Installer in Program Files>Unity> MonoDevelop> GTKSharp.( If prompted, Delete old GTK file and Re-Install GTK.) Then enter Unity and go to Edit>Preferences>External Tools>External Script Editor and Make Sure it is set to "MonoDevelop (Built-In)". Another thing that may help (I don't know if it 100% works) is to Install the .NET from MonoDevelop's Site. Also MAKE SURE UNITY IS FULLY INSTALLED! What my first problem was , it was that the Unity download would stop downloading because in task manager(CTRL+ALT+DEL>Task Manager) The "Windows Modules Installer" was running, so you have to end this task. And all of the files ( including the MonoDevelop file folder) will be there after the installation is done. Hope This Helped!