> For the complete documentation index, see [llms.txt](https://maxim218.gitbook.io/unity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://maxim218.gitbook.io/unity/chapter1.md).

# Базовые операции

## Вывод в консоль

Вывод сообщений в консоль

```
Debug.Log("String First");
Debug.Log("String Second");
Debug.Log("String Third");
```

## Движение и вращение локально

Движение с учётом текущего угла поворота

```
transform.Translate(0, 0, speedMove * Time.deltaTime);
transform.Rotate(0, speedRotating * Time.deltaTime, 0);
```

## Движение и вращение глобально

Движение в глобальном мире

```
transform.Translate(0, 0, speedMove * Time.deltaTime, Space.World);
transform.Rotate(0, speedRotating * Time.deltaTime, 0, Space.World);
```

## Движение объекта в направление цели

```
void Update () {
   GameObject targerGameObject = GameObject.Find("Sphere");
   float speed = 4.2f;
   transform.position = Vector3.MoveTowards(transform.position, targerGameObject.transform.position, speed * Time.deltaTime);
}
```

## Получение положения объекта

```
Vector3 pos = gameObject.transform.position;
string s = pos.x + "  " + pos.y + "  " + pos.z;
Debug.Log(s);
```

## Получение расстояния между объектами

```
GameObject person_1 = gameObject;
GameObject person_2 = GameObject.Find("Sphere");
float d = Vector3.Distance(person_1.transform.position, person_2.transform.position);
Debug.Log(d);
```

## Повернуться лицом к цели

```
Vector3 pos = GameObject.Find("Sphere").transform.position - transform.position;
Quaternion rotation = Quaternion.LookRotation(pos);
transform.rotation = rotation;
```

## Получить угол поворота по оси Y

```
float yyy = gameObject.transform.rotation.y;
Debug.Log(yyy);
```

## Изменение координат точки

```
Vector3 p = new Vector3(0, 0, 0);
p.x = 14;
p.y = 3;
p.z = 6;
gameObject.transform.position = p;
```

## Режим во весь экран

Сделать приложение во весь экран.

```
Screen.fullScreen = true;
```
