Exemple #1
0
        private static IEnumerable <BoundsData> GetObjectBounds(GameObject gameObject)
        {
            var transform = gameObject.transform;

            if (transform is RectTransform)
            {
                yield return(BoundsData.FromRectTransform((RectTransform)transform));
            }
            else
            {
                yield return(BoundsData.FromTransform(transform));
            }

            foreach (var renderer in gameObject.GetComponents <Renderer>())
            {
                yield return(BoundsData.FromRenderer(renderer));
            }

            foreach (var collider in gameObject.GetComponents <Collider>())
            {
                yield return(BoundsData.FromCollider(collider));
            }

            foreach (var lightProbe in gameObject.GetComponents <LightProbeGroup>())
            {
                BoundsData data;
                if (!BoundsData.TryCreateFromLightProbe(lightProbe, out data))
                {
                    continue;
                }

                yield return(data);
            }
        }
        private static IEnumerable <BoundsData> GetObjectBounds(GameObject gameObject)
        {
            var transform = gameObject.transform;

            if (transform is RectTransform)
            {
                yield return(BoundsData.FromRectTransform((RectTransform)transform));
            }
            else
            {
                yield return(BoundsData.FromTransform(transform));
            }

            foreach (var renderer in gameObject.GetComponents <Renderer>())
            {
                yield return(BoundsData.FromRenderer(renderer));
            }
        }