Hello. Suppose I repeatedly invoke a function that instantiates a random object. How can I use this to move the object(the one that is spawning the others) to the x.max bounding point of the newest object(and then, when the function is repeated, move to the next object, etc.)?
I have never used this, but looking at the docs you need to use this
After instantiating a new object you want to set your transform to it's x-max:
transform.position = Vector3(newObject.collider.bounds.extents.x,0,0);
The thing is though, your new instantiated object (which is random you said) will now be instantiated partly inside your previous object, because you compensated for the previous object's x-width, but not the new one's. So say first you used to instantiate at the position of the object you keep on moving to the right, now you want to instantiate at
newObject = Instantiate(object,Vector3(transform.position.x+object.collider.bounds.extents.x,transform.position.y ,transform.position.z)
If these objects have no collider, replace it with renderer.