Påverka andra objekt*
[SerializeField]
GameObject otherObject;void OnCollisionEnter(Collision collision)
{
GameObject otherObject = collision.gameObject
}Komponenter
void OnCollisionEnter(Collision collision)
{
HealthScript enemyHealth = collision.gameObject.GetComponent<HealthScript>();
enemyHealth.Injure(6);
}Last updated