Answer the question
In order to leave comments, you need to log in
Why is the object that gets into the trigger not passed to the public field?
There is such a code, as a result, a reference to an object falling within the boundaries of the trigger should be transferred to the public target field, but this does not happen, why?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IsTarget : MonoBehaviour
{
public GameObject target;
// Start is called before the first frame update
private void OnTriggerEnter(Collider other)
{
target=other.gameObject;
Debug.Log(target.name);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question