Unity 6.3
0 онлайн 1 гость 3 в системе
Вход

Collision2D.transform

Declaration

public Transform transform;

Описание

Transform входящего объекта, участвующего в столкновении.

Дополнительные ресурсы: Transform class.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void OnCollisionEnter2D(Collision2D collision2D) { //If the object we collided with was an Asteroid. if (collision2D.transform.name == "Asteroid") { //Sets this object as the new parent of the Transform of the object involved in the collision. collision2D.transform.SetParent(gameObject.transform); } } }