What I mean by this, is that my player, when he reaches the edge of my camera/ background, he continues to move at the other corner of the screen.
Important is to notice, that I mean a 2D Top Down game.
I have no idea how I should do this, and I hope you can help me.
My aim is to let it look like this:
You can manualy move player to other side of the screen whe he goes out of bounds. Here’s a simple script that works assumming your camera is centered at the world origin.
using UnityEngine;
public class WrappingLevel : MonoBehavior
{
public float horizontalSize;
public float verticalSize;
void Update()
{
if(Mathf.Abs(transform.position.x) > horizontalSize)
{
transform.position = new Vector3(-transform.position.x, transform.position.y);
}
if (Mathf.Abs(transform.position.y) > verticalSize)
{
transform.position = new Vector3(transform.position.x, -transform.position.y);
}
}
}