VS2022+unity3D development environment construction

1 Install Unity

  • Install Unity HubInstall
    Unity It is recommended to use the Unity Hub management program (official management program).
    Unity Hub is a management tool that allows you to manage all your Unity projects and installations. Use the Hub to manage multiple installations of the Unity Editor and its associated components, create new projects, and open existing projects.
    Official website download: https://store.unity.com/cn/download

  • Install Unity.
    Open Unity Hub, select the Installs tab, select the Official Releases page, select a version you want to install and click Download.
    Insert image description here

2 Debugging using Visual Studio

  • Go to Microsoft's official website to download VS2022
    https://visualstudio.microsoft.com/zh-hans/downloads/
    When installing, select game development using Unity

  • After installation, we first create a U3D project
    Insert image description here

  • Then we open Unity Editor -> Editing -> Preferences -> External Tools, and we can see that the value of the "External Script Editor" item is Visual Studio. At this time, double-click the script file in the Editor, and the system will start Visual Studio as an IDE for editing.
    Insert image description here

  • In the project, create a new script, right-click or double-click to edit the script
    Insert image description here

  • After installing the development environment, Visual Studio can start the Unity game process for code debugging. What we have to do is edit the code in Visual Studio. Then select the "Attach to Unity and Play" button to start debugging. Visual Studio will start the game process and run it until it stops at the breakpoint, displaying various code statuses.
    After clicking the debug button, the interface will jump back to Unity and start running the game process. When the breakpoint is reached, it will jump back to Visual Studio to display the debugging interface.
    Insert image description here

Guess you like

Origin blog.csdn.net/qq_33957603/article/details/124652720