Hello, how do I use variable “target” instead of the name of the object “box1” in this script:
var target : Transform;
function OnTriggerEnter (hit:Collider) {
if(hit.gameObject.name == "box1"){
Hello, how do I use variable “target” instead of the name of the object “box1” in this script:
var target : Transform;
function OnTriggerEnter (hit:Collider) {
if(hit.gameObject.name == "box1"){
The “transform” object has a property called gameObject as well. You would do:
if(hit.gameObject == target.gameObject) {