When you are instantiating an object, is there any way to affect the scale of that object?
thiis should get you going
public GameObject objectPrefab; // whatever you want to instantiate
public Vector3 location; // place you want it
GameObject newObject = Instantiate(objectPrefab, location, Quaternion.identity) as GameObject; // instatiate the object
newObject.transform.localscale = new Vector3(whatever.x, whatever.y, whatever.z); // change its local scale in x y z format
12 Likes
Thanks!
“localScale” Watch the captials in novashot’s response
2 Likes
Thanks.
This is not helping me when I use a auto generated float variable in x position, it become zero …please help
It’s been a while, but why not just set the auto-generated float variable x to a value that’s higher than zero? Fix the value to make sure it is higher than 0 and you should be fine
Please don’t necropost.
Thanks.