What would be the cost of doing this. It seems efficient to me. The object is referenced as a variable. Then when required, a script attached to it is accessed by name using GetComponent() and some action is taken. I don’t see any searching to be required.
you can store all references for future use like this:
public GameObject myObj; private Transform myTransform; private MyScript myScript; void Start() { myTransform = myObj.transform; myScript = myObj.GetComponent(); }
if you have a trigger, you also can store local references or simple implement OnTriggerEnter in script you need reference to.