Мои Уведомления
Привет, !
Мой Аккаунт Мои Финансы Мои Подписки Мои Настройки Выход
Руководство API скрипты

Объявление

public void Set(float newX, float newY, float newZ);

Описание

Установите компоненты x, y и z существующего Vector3.

// Прикрепите этот скрипт к GameObject. Создайте пустой GameObject, который будет действовать как "Новое преобразование". Назначьте это в Инспекторе. // Нажмите кнопку "Установить" в игре, чтобы установить положение GameObject в положение "Новое Transform". using UnityEngine; using UnityEngine.EventSystems; public class Example : MonoBehaviour { // Use this to set the new position of the GameObjectVector3 m_MyPosition; // Set an external Transform in the Inspector which is the GameObject’s starting point public Transform m_NewTransform; void Start() { // Set the new Vector to be that of the Transform you attach in the Inspector m_MyPosition.Set(m_NewTransform.position.x, m_NewTransform.position.y, 0); } void OnGUI() { // Press the Button to set the GameObject to this new position if (GUI.Button(new Rect(0, 0, 100, 40), "Set")) { transform.position = m_MyPosition; } } }
Вы можете отблагодарить автора, за перевод документации на русский язык. ₽ Спасибо
API скрипты 2021.3