How to create a looping or spherical world?

I wish to create a 3D first person world, in which the player, once they reach one end of the map are unknowingly transported back to the opposite end, or a spherical world with a surface where the player can walk on while still experiencing gravity like normal. Unfortunately I couldn't find a good solution for doing that in either unity or ue. Any ideas would be appreciated.

I am not familiar with the Unreal engine, so this answer will focus solely on Unity.

Unity's game scenes are strictly euclidean and do not allow real portals. But what you can do is separate the level into individual prefab segments which you remove and add to the scene while the player is moving through the game or looking away. This method is, for example, used in the game Antichamber to create spacially impossible levels. In a game with more open scenarios you could divide the game world into cubic chunks which you destroy when the player moves out of view-range and instantiate when they come closer (I suspect Kerbal Space Program uses this approach to render planet surfaces).

If you want to create a spherical planet and it will not be too large and complex to keep it completely in memory all the time, you can do that by not using the gravity of the Unity physics system but instead calculate the gravity acceleration by yourself based on the relative position to the center of the planet and orientate all objects to always be rotated perpendicular to the center of gravity.

In Unity you can do this:

I had the same "dream" of making a spherical gamemap for years. I eventually made a solution for gravity on a spherical map. And even if it's not perfect, here is a simple example of how I did it. Apply this script to an object (fx a car or whatever) with a rigidbody in Unity. Vector3.zero is the center of the "planet" and can be replaced with your "planets" transform.position. Don't forget to make your planets rigidbody kinematic (check the box) so that the planet doesn't move too on impact from other objects. Hope this helps :)

C-sharp (C#) script code:

using UnityEngine;
using System.Collections;

public class Gravity : MonoBehaviour {

public float gravityForce;
public Rigidbody rb;

void Start()
{
rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{