public CelestialBody FindMostProperAttractor(CelestialBody body)
        {
            if (body == null)
            {
                return(null);
            }
            CelestialBody resultAttractor = null;

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                bodies = new List <CelestialBody>(GameObject.FindObjectsOfType <CelestialBody>());
            }
#endif
            // Search logic:
            // calculate mutual perturbation for every pair of attractors in scene and select one,
            // which attracts the body with biggest force and is least affected by others.
            foreach (var otherBody in bodies)
            {
                if (otherBody == body || !otherBody.isActiveAndEnabled || otherBody.mass < minAttractorMass || (otherBody.position - body.position).magnitude > Mathd.Min(maxAttractionRange, otherBody.maxAttractionRange))
                {
                    continue;
                }
#if UNITY_EDITOR
                if (!Application.isPlaying)
                {
                    otherBody.FindReferences();
                }
#endif
                if (resultAttractor == null)
                {
                    resultAttractor = otherBody;
                }
                else
                if (CelestialBodyUtils.RelativePerturbationRatio(body, resultAttractor, otherBody) > CelestialBodyUtils.RelativePerturbationRatio(body, otherBody, resultAttractor))
                {
                    resultAttractor = otherBody;
                }
            }
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                bodies.Clear();                 //bodies must be empty in editor mode
            }
#endif
            return(resultAttractor);
        }
        /// <summary>
        /// Find attractor, which have most gravitational influence at target body.
        /// </summary>
        /// <param name="body">Target body.</param>
        /// <returns>Most proper attractor or null.</returns>
        /// <remarks>
        /// Search logic:
        /// Calculate mutual perturbation for every pair of attractors in scene and select one,
        /// which attracts the body with biggest force and is least affected by others.
        /// </remarks>
        public CelestialBody FindMostProperAttractor(CelestialBody body)
        {
            if (body == null)
            {
                return(null);
            }
            CelestialBody resultAttractor = null;

#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                Bodies = new List <CelestialBody>(GameObject.FindObjectsOfType <CelestialBody>());
            }
#endif
            foreach (var otherBody in Bodies)
            {
                if (otherBody == body || !otherBody.isActiveAndEnabled || otherBody.Mass < MinAttractorMass || (otherBody.Position - body.Position).magnitude > Mathd.Min(MaxAttractionRange, otherBody.MaxAttractionRange))
                {
                    continue;
                }
#if UNITY_EDITOR
                if (!Application.isPlaying)
                {
                    otherBody.FindReferences();
                }
#endif
                if (resultAttractor == null)
                {
                    resultAttractor = otherBody;
                }
                else
                if (CelestialBodyUtils.RelativePerturbationRatio(body, resultAttractor, otherBody) > CelestialBodyUtils.RelativePerturbationRatio(body, otherBody, resultAttractor))
                {
                    resultAttractor = otherBody;
                }
            }
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                Bodies.Clear(); //bodies must be empty in editor mode
            }
#endif
            return(resultAttractor);
        }