Hi , If a object collides with a bullet (prefab) that contains a certain script, in this case, enemytrooper1, i want to access a variable of enemytrooper1, for some reason when i input the lines
function OnTriggerStay (other : Collider)
{
if (other.gameObject.GetComponent.())
{
//do something
}
}
it doesnt seem to find the fact that the bullet has collided with the other object, both colliders are present. I’ve never tried to access a script this way so not sure if i’m doing something wrong.
the public variable is in the script and the script name is enemytrooper1
after running your example i get the error
null referenceexception : object reference not set to an instance of an object
enemybulletscript.ontriggerstay (unityengine.collider.other) (at asseets/enemybulletscript.js: 76)