unity move object from another script code example
Example 1: unity how to move an object to another object
transform.position = new Vector3(GameObject.Find("Object").transform.position.x, GameObject.Find("Object").transform.position.y, GameObject.Find("Object").transform.position.z);
transform.position = new Vector2(GameObject.Find("Object").transform.position.x, GameObject.Find("Object").transform.position.y);
Example 2: unity move object from another script
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);
}
}
}