Hello!
Since the game object won’t scale through using variables that are linked to instantiation (well, without re-scaling the prefab, itself), I was planning on using a GameObject.Find() component to scale it manually.
However, is there a way to reference THAT model?
Basically what I’m saying is if I have like 5 clones of a model up, certainly GameObject.Find() won’t return the right one… so how do I make it do so? Is there a feature like…
GameObject instantiate…;
GameObject.Find(lastCreatedGameObject);
or is it a hell of a lot more complex than that?
“Instantiate” returns the created GameObject. You just need to get its return to a variable (taken from manual):
// Instantiate a prefab with an attached Missile script
var projectile : Missile;
function Update () {
// Ctrl was pressed, launch a projectile
if (Input.GetButtonDown("Fire1")) {
// Instantiate the projectile at the position and rotation of this transform
var clone : Missile;
clone = Instantiate(projectile, transform.position, transform.rotation);
// Set the missiles timeout destructor to 5
clone.timeoutDestructor = 5;
}
}
One way to keep track would be to instantiate them and add them to a list / array at the same time. That way you can reference the indexes for which one you want to scale. You can use List.Count to see how many objects are currently in the List and then access the last one in.
Hope that helps 