Перейти к содержимому

Как поменять ide в unity

  • автор:

Как подключить Visual Studio к Unity?

К самой Unity Visual Studio подключена но когда в Unity создаю новый скрипт и запускаеться Visual Studio там нету почти ни чего что означало подключение тоесть команды связанные с юнити он не узнает, и системы исправления нету и так далее

  • Вопрос задан более трёх лет назад
  • 18393 просмотра

2 комментария

Простой 2 комментария

GavriKos

GavriKos @GavriKos Куратор тега Unity
А вы точно открываете солюшен сгенерированный?
Kifoter @Kifoter Автор вопроса
Решения вопроса 0
Ответы на вопрос 1

Dywar

Вы точно что то забыли.

Вот статья о том как настроить совместную работы Unity 3D и Visual Studio — https://docs.microsoft.com/ru-ru/visualstudio/cros.

Справа вверху есть переключаться на Русский язык.

Ответ написан более трёх лет назад
Нравится 3 2 комментария
Kifoter @Kifoter Автор вопроса

сделал все выше приведенные действия, создал скрипт, вписал код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
public Transform SelfTransform;
void Update()
SelfTransform.Translate(0.1f, 0, 0);
>
>
присойденил к персонажу и вылазит эта ошибка:
UnassignedReferenceException: The variable SelfTransform of NewBehaviourScript has not been assigned.
You probably need to assign the SelfTransform variable of the NewBehaviourScript script in the inspector.
UnityEngine.Transform.get_position () in :0
UnityEngine.Transform.Translate (UnityEngine.Vector3 translation, UnityEngine.Space relativeTo) (at C:/buildslave/unity/build/Runtime/Transform/ScriptBindings/Transform.bindings.cs:118)
UnityEngine.Transform.Translate (System.Single x, System.Single y, System.Single z) (at C:/buildslave/unity/build/Runtime/Transform/ScriptBindings/Transform.bindings.cs:134)
NewBehaviourScript.Update () (at Assets/NewBehaviourScript.cs:10)
Что сделать чтобы работало?

Dywar

Kifoter, извини, долго не заходил.
Я сам этого не люблю, но нужно читать тексты ошибок.

В данном случае текс ошибки сообщать что нужно сделать что устранить ее — «The variable SelfTransform of NewBehaviourScript has not been assigned. You probably need to assign the SelfTransform variable of the NewBehaviourScript script in the inspector.».

Рус перевод — «Переменная SelfTransform для NewBehaviourScript не была назначена. Возможно, вам нужно назначить переменную SelfTransform сценария NewBehaviourScript в инспекторе.».

Unity Development with VS Code

Visual Studio Code makes it easy to write and debug your C# scripts for Unity.

Unity Overview

This guide will help you make Unity and Visual Studio Code work together. If you’re looking for resources to learn C#, check out our C# curriculum.

If you’re looking for resources to learn Unity, check out the learning section of the Unity website.

Read on to find out how to configure Unity and your project to get the best possible experience.

Install

  1. You will need at least Unity 2021 installed.
  2. If you haven’t already done so, install Visual Studio Code.
  3. Next, install the Unity for Visual Studio Code extension from the Visual Studio Marketplace. For additional details on installing extensions, read Extension Marketplace. The Unity extension is published by Microsoft.

Installing the Unity extension installs all its dependencies required to write C# with Visual Studio Code, including the C# Dev Kit.

Set up Unity

Update the Visual Studio Package

The Unity extension for Visual Studio Code depends on the Visual Studio Editor Unity Package. In Unity, open up Windows, Packages. Make sure the Visual Studio Editor package is upgraded to 2.0.20 or above.

Unity Package Manager

Note: The Visual Studio Code Editor package published by Unity is a legacy package from Unity that is not maintained anymore.

Set VS Code as Unity’s external editor

Open up Unity Preferences, External Tools, then select Visual Studio Code as External Script Editor.

Unity Preferences

Editing Evolved

You are now ready to start editing with Visual Studio Code. Double-clicking on a C# script in Unity will open Visual Studio Code. Here is a list of some of the things you can expect:

  • Syntax Highlighting
  • Bracket matching
  • IntelliSense
  • Snippets
  • CodeLens
  • Peek
  • Go-to Definition
  • Code Actions/Lightbulbs
  • Go to symbol
  • Hover

Two topics that will help you are Basic Editing and C#. In the image below, you can see VS Code showing hover context, peeking references, and more.

editing evolved example

Debugging

By default, your Unity project is setup with a debugger configuration to attach the Unity debugger to the Unity Editor instance opened on the project. Press F5 to start a debugging session.

If you want to debug a Unity standalone player, the easiest way is to use the Attach Unity Debugger command.

Alternatively, you can modify the .vscode/launch.json file in your project and add a new debugger configuration for an IP endpoint you control:

 "name": "Attach to Xbox", "type": "vstuc", "request": "attach", "endPoint": "127.0.0.1:56321" > 

Next steps

Read on to learn more about:

  • Basic Editing — Learn about the powerful Visual Studio Code editor.
  • Code Navigation — Move quickly through your source code.
  • C# — Learn about the C# support in Visual Studio Code.

Set your default script editor (IDE)

icon

Unity.com

icon

Новостная рассылка

icon

Asset Store

icon

Играть

icon

Unity Academic Alliance

icon

Сертификация Unity

icon

Преподаватели

© 2023 Unity Technologies

  • Правовая информация
  • Политика конфиденциальности
  • Cookie-файлы
  • Использование персональных данных
  • Настройки cookie-файлов

«Unity», логотипы Unity и другие торговые знаки Unity являются зарегистрированными торговыми знаками компании Unity Technologies или ее партнеров в США и других странах(подробнее здесь).Остальные наименования и бренды являются торговыми знаками соответствующих владельцев.

Unity

Unity is a game-development environment that is used to create 2D and 3D games and deploy them on multiple platforms. JetBrains Rider provides powerful support for Unity including: Unity-specific quick fixes, context actions and inspections, code completion and syntax highlighting in shader files, debugging Unity scripts, running and debugging Unity tests, profiling Unity games, refreshing assets, and much more.

Supported versions

JetBrains Rider provides support for Unity API versions 5.0 — 5.6, 2017.1 and later.

Get started

Support for Unity is based on the open-source Unity Support plugin. The plugin comes bundled with Rider, so manual installation is not required.

Start using Rider with your Unity project

JetBrains Rider: Connected to Unity editor

  1. Open an existing Unity project in the Unity Editor.
  2. Select Edit | Preferences in the Unity Editor and open the External Tools page.
  3. In the External Script Editor , select a JetBrains Rider installation.
  4. While still in the Unity Editor, right-click anywhere in the Project view and select Open C# Project
  5. Rider will start automatically and open the solution related to this Unity project. Once the solution is loaded, Rider and the Unity Editor become connected. The Unity icon on the toolbar shows the current connection status:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *