unity move object from another script code example

Example 1: unity how to move an object to another object

// 3D
transform.position = new Vector3(GameObject.Find("Object").transform.position.x, GameObject.Find("Object").transform.position.y, GameObject.Find("Object").transform.position.z);

// 2D
transform.position = new Vector2(GameObject.Find("Object").transform.position.x, GameObject.Find("Object").transform.position.y);

Example 2: unity move object from another script

// Moving a list of objects down on key press
public GameObject[] deck;
public float movementSpeed = 30;

void Update()
    {
        if (Input.GetKey(KeyCode.E))
        {
            foreach (var obj in deck) 
            {
                obj.transform.Translate(Vector3.down * movementSpeed * Time.deltaTime);
            }
        }
    }