Perhaps this is a really stupid issue and I’m overlooking something here, but this has managed to stump me for several days now. I’ve just picked up Unity (and Javascript, for that matter) and I’m using a tower defense tutorial, and the particular bit of code (I think) which is tripping me up is as follows:
function onTriggerEnter(other : Collider)
{
nextFireTime = Time.time+(reloadTime * 5);
myTarget = other.gameObject.transform;
}
The nextFireTime bit is irrelevant; it’s the myTarget part that’s screwing me. I don’t know what to say, it simply refuses to recognize anything has entered the trigger and fails to change the value for the myTarget variable, thus rendering the whole script useless. The entity I’m putting into the trigger is a simple cube with a rigidbody (which as I understand is necessary).
Any help would be much appreciated, and I’ll gladly provide any info I’ve failed to include. Cheers.