© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
12 replies
Raptorini

❔ How can I make an instantiated object move?

I'm trying to make an object spawned with the instantiate function move, but I can't get it to work. Can anyone help me?

public class Spawn_Cells : MonoBehaviour
{
public GameObject cell;
public float speed = 2;
public Vector3 cellDirection = new Vector3(1, 1, 0);

void Start()
{
Vector3 randomPosition = new Vector3(Random.Range(10f, -10f), Random.Range(4f, -4f), 0);
Instantiate(cell, randomPosition, Quaternion.identity);
}

void Update()
{
cell.transform.Translate(cellDirection * speed * Time.deltaTime);
}

}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How to make instantiated object move using transform function?
C#CC# / help
4y ago
❔ How to make instantiated object move with transform function?
C#CC# / help
4y ago
❔ How to make an object follows my mouse?
C#CC# / help
4y ago