Way to scale all assets in a scene

Does anyone know of a component or a way to scale multiple objects in a scene, including hierarchies of objects and objects created externally as well as internally ? It I want to be able to set an arbitrary scale amount, then scale the specified objects and colliders while keeping all the objects in the same relative place.

runtime or edit time? If at runtime, is this a one time event or something that happens through out the game?

Edit time.

1 Answer

1

Vector3 center, scale;

foreach ( var root in FindObjectsOfType<Transform>().Where(t => t == t.root) )
{
	root.position = Vector3.Scale(root.position - center, scale) + center;
	root.localScale = Vector3.Scale(root.localScale, scale);
}