It seems the following all seem to work the same. Is there any difference with what I’m doing here (any performance difference, for example?)
OnTriggerEnter ( other : Collider )
{
other.GetComponent(someScript).Activate();
other.gameObject.GetComponent(someScript).Activate();
other.transform.GetComponent(someScript).Activate();
}
“GetComponent” function is belong to GameObject. but in Transform, it just a Inherited function from GameObject. there’s no difference CMIIW
A gameObject is a collection of components, whereas transform IS a component. Now, as the property transform is a the same as GetComponent(…) and is accessible from any component, even itself, this is correct (but redondant) :
print( obj.transform.transform.transform.transform.transform.transform.position );