// Measure the size of the platforms and scenes
        public void GetObjectSizes(out Vector3[] platformSizes, out Vector3[] sceneSizes, out float largestSceneLength)
        {
            platformSizes = new Vector3[platforms.Length];
            for (int i = 0; i < platforms.Length; ++i)
            {
                if (platforms[i].overrideSize != Vector3.zero)
                {
                    platformSizes[i] = platforms[i].overrideSize;
                }
                else
                {
                    Renderer platformRenderer = platforms[i].GetComponent <Renderer>();
                    if (platformRenderer == null)
                    {
                        Debug.LogError("Error: platform " + platforms[i].name + " has no renderer attached and does not override the size. Add a renderer or override the size to remove this error.");
                        platformSizes[i] = Vector3.zero;
                        continue;
                    }
                    platformSizes[i] = platforms[i].GetComponent <Renderer>().bounds.size;
                    Vector3 heightChange = platformSizes[i];
                    if (platforms[i].slope != PlatformSlope.None)
                    {
                        heightChange.y *= platforms[i].slope == PlatformSlope.Down ? -1 : 1;
                    }
                    else
                    {
                        heightChange.y = 0;
                    }
                    platformSizes[i] = heightChange;
                }
            }

            // the parent scene object must represent the children's size
            sceneSizes         = new Vector3[scenes.Length];
            largestSceneLength = 0;
            for (int i = 0; i < scenes.Length; ++i)
            {
                if (scenes[i].overrideSize != Vector3.zero)
                {
                    sceneSizes[i]  = scenes[i].overrideSize;
                    sceneSizes[i] += scenes[i].centerOffset;
                    SceneAppearanceRules sceneAppearanceRule = scenes[i].GetComponent <SceneAppearanceRules>();
                    if (sceneAppearanceRule.linkedPlatforms.Count == 1)
                    {
                        PlatformObject linkedPlatform = sceneAppearanceRule.linkedPlatforms[0].platform as PlatformObject;
                        if (linkedPlatform.slope == PlatformSlope.None)
                        {
                            sceneSizes[i].y = 0;
                        }
                    }
                }
                else
                {
                    Renderer sceneRenderer = scenes[i].GetComponent <Renderer>();
                    if (sceneRenderer == null)
                    {
                        Debug.LogError("Error: scene " + scenes[i].name + " has no renderer attached and does not override the size. Add a renderer or override the size to remove this error.");
                        sceneSizes[i] = Vector3.zero;
                        continue;
                    }
                    sceneSizes[i]   = scenes[i].GetComponent <Renderer>().bounds.size;
                    sceneSizes[i]  += scenes[i].centerOffset;
                    sceneSizes[i].y = 0;
                    SceneAppearanceRules sceneAppearanceRule = scenes[i].GetComponent <SceneAppearanceRules>();
                    if (sceneAppearanceRule.linkedPlatforms.Count == 1)
                    {
                        PlatformObject linkedPlatform = sceneAppearanceRule.linkedPlatforms[0].platform as PlatformObject;
                        if (linkedPlatform.slope != PlatformSlope.None)
                        {
                            sceneSizes[i].y = linkedPlatform.GetComponent <Renderer>().bounds.size.y *(linkedPlatform.slope == PlatformSlope.Down ? -1 : 1);
                        }
                    }
                }
                if (largestSceneLength < sceneSizes[i].z)
                {
                    largestSceneLength = sceneSizes[i].z;
                }
            }

            // The scene appearance rules need to know how much buffer space there is between the platform and scene
            if (sceneSizes.Length > 0)
            {
                float buffer = (sceneSizes[0].x - platformSizes[0].x) / 2 + platformSizes[0].x;
                for (int i = 0; i < scenes.Length; ++i)
                {
                    scenes[i].GetComponent <SceneAppearanceRules>().SetSizes(buffer, sceneSizes[i].z);
                }
            }
        }