How to calculate the bounds of an object when it does not have Renderer, Mesh or Collider components.
CodePudding user response:
You could get all child renderers (or colliders), then unite all of them.
var renderers = gameObject.GetComponentsInChildren<Renderer>();
var bounds = renderers[0].bounds;
for (var i = 1; i < renderers.Length; i)
bounds.Encapsulate(renderers[i].bounds);