C
C#2y ago
Raptorini

❔ How to make instantiated object move with transform function?

I'm quite new to Unity, so this might be really easy. public GameObject cell; public float speed = 1; public Vector3 cellDirection = new Vector3(1,1,0); void Start() { Vector3 randomPosition = new Vector3(Random.Range(10, -10), Random.Range(4, -4), 0); Instantiate(cell, randomPosition, Quaternion.identity); } void Update() { cell.transform.Translate(cellDirection * speed * Time.deltaTime); } For now, I wanna spawn a cell in a random place and make it move in a certain direction. The spawning works, but the cell will not move. Can anyone help me with this?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server