Hello All,
I’m new to using Unity, but have experience in game design otherwise, and I’m hoping you can help me with something that should be pretty straightforward, but I’m just not sure how to do it.
I have a prototype of an infinite runner, with the scripts needed to spawn platforms as the game goes, but they are just floating platforms. I want to add some body to the platform so I’m trying to add another cube gameobject below them to look like the platforms are elevated. The problem is they cover up the player, and I’d like the player to be in front of them.
That bit of grey (where the arrow is pointing to) hides the player, and I’m looking for more of an old-school Mario thing where the player walks in front of that, but still interacts with the platform above it.
Thanks!
Hi!
I’ve come across this problem several times in using Unity’s 2D system.
There’s a few things that could be causing this:
A) There is an object in 3D space in front of the sprite(For instance a plane.)
B) The camera is not set to orthographic(2D)
C) The character object’s sprite-renderer Order in Layer value is set to 0.
Now, for the solutions!
A) Disable the object, and replace it with a 2D sprite that has a lower Order in Layer value versus the player.
B) Set the camera to orthographic
C) Set the character object’s sprite-renderer Order in Layer value to something higher than 1.
Hopefully this helped. If it didn’t, feel free to comment on this and I will attempt helping you further.
Thanks for the quick answer @DeathDev!
I think the issue I’m causing myself is that I’m making 3D game objects that are sticking further out than the player. I fixed this by changing their z-axis to be behind the player and that seems to have fixed the problem.
Those, is there a way to create a 2D object(sprite) and just work in layers from there? That seems like a much simpler way to do it!