- Home /
talk to a clone object
hi guys i am wanting to learn how i get a gameobject or transform to talk to the clone object and not by a name but i know there is another way for eg
public gameobject bullet;
void start()
instansate(bullet);
update(){
bullet(clone).transform.movetowards target; <<< there will be more then one bullet so 2 per plane 20 planes etc }
Answer by vietoilaviet89 · Apr 30, 2018 at 04:30 AM
public GameObject bullet;
public List<GameObject> bullets;
private void Start()
{
bullets = new List<GameObject>();
GameObject bulletClone = Instantiate<GameObject>(bullet);
bullets.Add(bulletClone);
//Do something with the clone for example...
bullets[0].transform.position = Vector3.zero;
bullets[0].gameObject.name = "bullet0";
}
Hi there, not sure what you meant but you can store clone objects using List then retrieve them whenever you want.
Answer by karljohnvillardar · Mar 24 at 12:38 PM
If you want to clone bullets, you might want to use an object pool.
Your answer

Follow this Question
Related Questions
Instatiated objects should have all the same name. 2 Answers
Destroy all clones 2 Answers
How to destroy a clone (instantiate in scene) in the their own script 1 Answer
[Re-Edited] Clone Of Bejeweled for Android 3 Answers
I want to only destroy 3 of the clone prefabs that appear how would I do this? 1 Answer