Accessing other objects

Hi, I’m really a beginner in Unity. I wonder how can I from script that belongs to one object access components from other object. Which function to use? I’ve found something like FindObjectWithTag() but I’m not sure if that’s the right way

if this object is one you have already, then:

  • declare a public variable in script
public Transform myTransform;
  • in editor, attach some transform to this script (script should be attached already to another some object). attach can be done by drag-n-drop
  • use this some transform in script simple
myTransform.position = ....;

You have it all (or almost) answered here: