I’m new to Unity as well as game engines and am still learning how to deal with cameras, rendering and the like.
My first project is an attempt to execute a lot of basic mechanical tropes in 2D platformers. I am using Unity in it’s 2D layout with 2D assets.
Currently, I’m trying to have the edges of the screen be connected, meaning if you jump off the right side of the screen, you will show up on the left side and vice-verse.
This is very easy to do in the basic position (transform) sense, but I’m unsure how to approach actual rendering.
I’d like to have the sprite show up partially at each side of the screen if she is currently in between. I want to have 0 space between the left and right side of the screen. When you walk off the right side, the sprite starts appearing on the left side of the screen immediately.
Code samples are highly appreciated!
If you use pro version. You could do this using RenderTexture.
If you have pro version comment and I will write something like tutorial how to do this.
Hope that helps you somehow,
I ended up creating a clone on the opposing side of the screen and then teleporting to it and destroying it when my original gets completely out of the screen.
The clone is an imperfect one, which means it’s a different prefab. The only difference is in the “side to side teleport” script. The original can create clones once he reaches the proper point, and if he goes beyond the screen, he teleport to the location of the clone, and destroys it. The clone can not create other clones himself, but does destroy himself if he ever goes off screen (which means the original decided not to go all the way out of the screen).
This explanation is kind of hard to follow. I made a video that shows it in action if that helps. (The video does not contain code).
This might be helpful even though the solution is more of a hack.