// An object run contains many platforms strung together with collidables: obstacles, power ups, and coins. If spawnObjectRun encounters a turn,
    // it will spawn the objects in the correct direction
    public void spawnObjectRun(bool activateImmediately)
    {
        while (localDistance[(int)ObjectLocation.Center] < horizon && turnPlatform[(int)ObjectLocation.Center] == null)
        {
            PlatformObject platform = spawnObjects(ObjectLocation.Center, localDistance[(int)ObjectLocation.Center] * moveDirection + localPlatformHeight[(int)ObjectLocation.Center] * Vector3.up + turnOffset,
                                                   moveDirection, activateImmediately);
            if (platform == null)
            {
                return;
            }

            platformSpawned(platform, ObjectLocation.Center, moveDirection, Vector3.zero, activateImmediately);

            if (spawnFullLength)
            {
                spawnObjectRun(activateImmediately);
            }
        }

        if (turnPlatform[(int)ObjectLocation.Center] != null)
        {
            Vector3 turnDirection = turnPlatform[(int)ObjectLocation.Center].getTransform().right;

            // spawn the platform and scene objects for the left and right turns
            for (int i = 0; i < 2; ++i)
            {
                ObjectLocation location = (i == 0 ? ObjectLocation.Right : ObjectLocation.Left);

                bool canTurn = (location == ObjectLocation.Right && turnPlatform[(int)ObjectLocation.Center].isRightTurn) ||
                               (location == ObjectLocation.Left && turnPlatform[(int)ObjectLocation.Center].isLeftTurn);
                if (canTurn && turnPlatform[(int)location] == null)
                {
                    infiniteObjectHistory.setActiveLocation(location);
                    Vector3 centerDistance = (localDistance[(int)ObjectLocation.Center] + turnPlatform[(int)ObjectLocation.Center].turnLengthOffset) * moveDirection;
                    if (localDistance[(int)location] < horizon)
                    {
                        PlatformObject platform = spawnObjects(location, centerDistance + turnDirection * localDistance[(int)location] + localPlatformHeight[(int)location] * Vector3.up + turnOffset,
                                                               turnDirection, activateImmediately);
                        if (platform == null)
                        {
                            return;
                        }

                        platformSpawned(platform, location, turnDirection, centerDistance, activateImmediately);
                    }
                }
                turnDirection *= -1;
            }

            // reset
            infiniteObjectHistory.setActiveLocation(ObjectLocation.Center);
        }
    }