Linux Ubuntu18.04 configures the Unity3D development environment and solves problems such as Dotnet Mono Omnisharp in VSCode to implement MonoBehaviour code prompts

Introduction

If you say that installing Unity3D and configuring the Unity3D development environment on Windows are already a headache. Then, building a Unity3D development environment in Linux is even more crazy. There are very few such tutorials on the Internet, and there are no ready-made solutions to problems when they arise. Many pitfalls are filled by constant attempts by oneself. It is roughly divided into the following pitfalls: 1. Unsuccessful configuration of Unity3D software in Ubuntu 18.04; 2. VSCode cannot recognize Dotnet; 3. VSCode cannot recognize Mono; 4. VSCode's Omnisharp fails.

1. Ubuntu18.04 installs Unity3D and successfully packages the APK file

In order to ensure that Unity3D can successfully compile Android (apk) or Windows (exe) files and perfectly cooperate with VSCode, the following points should be noted:

  1. Do not download the Unity installation package directly. To download the UnityHub software suitable for Linux , go to the following address to download the Linux (.deb) file;
    link: click the Download UnityHub buttonInsert image description here

  2. You can successfully install the hub with the dpkg -i command. This step is generally smooth;

  3. Directly add the listed Unity3D version to the hub. Although you can click the "Download from Hub" button on the website to transfer to the local Hub for download, there are several problems with this method: First, there is no guarantee that the local Hub will capture the web page. All Unity versions on the client; second, the captured web version, especially the 2019 version and below, does not have environment configurations such as ANdroid-Build-Support, NDK, etc., which is very inconvenient; third, the captured web version or after manual installation by yourself The version assigned to Hub may cause problems such as computer freezes during packaging, new empty projects not creating any files, etc. (I have already experienced these pitfalls);
    Insert image description here

  4. Don’t use Hub’s own SDK and JDK! Don’t use Hub’s own SDK and JDK! Don’t use Hub’s own SDK and JDK! SDK and JDK must be installed and specified manually. The SDK that comes with Hub lacks ADB and other issues, and the one that comes with Hub called OpenJDK is also incomplete;


4.1 AndroidSDK installation method:
Ubuntu18.04 comes with a Snap store. There is an AndroidSDK Manager tool in the store. It is very convenient to query and install various versions of AndroidSDK. The code is as follows:

sudo snap install androidsdk //安装androidsdk
androidsdk --list //查询可安装的包,主要安装build-tools和platforms
androidsdk 'build-tools;29.0.2'  //安装29.0.2版build-tools
androidsdk 'platforms;android-29'  //安装29.0.0版platforms

4.2 JDK installation method:
to O

Guess you like

Origin blog.csdn.net/qq_39889893/article/details/128366605