- Home /
Imported asset renders in front of player but behind background in 2d platformer microgame
I'm new to Unity, so I started with the 2d Platformer microgame. After completing the tutorial, I decided to learn how to create my own assets in Blender and import them to Unity. So I made this red button switch in Blender, exported it as an FBX, and then imported it into Unity as a prefab (the model is actually two objects, I'm not sure how relevant that is).
Everything seems to be okay when I'm not playing the game, but when I playtest it, I see some strange behavior: linkHere are some images that show the strange behavior : the switch appears to be behind the background but simultaneously in front of the player.
At first I thought "it must be that the background is closer to the camera than my switch", so I looked in the transform compnent for my asset. Almost everything else (the grid, the player, the background) seems to be at Z value 0, so I adjusted my assets z values a couple times but nothing fixed it. Then I looked at the background and the player models' renderer components a litle more and noticed that they had different "order in layer" values (the player and foreground have order 5, the level has order 0 and the background has order -1; all of them are in the default sorting layer). So I added a TileRenderer component to my prefab asset, set it to the default sorting layer and played with the "order in layer" value a bit, but again nothing seemed to fix the problem. I briefly looked at the Unity manual, but I'm not familiar enough with Unity yet to make sense of a lot of what I read.
So I now I ask for help: what am I overlooking about why my imported asset is behaving this way? What can I do to it so it render behind the player but in front of the background? Thanks for the help.
Your answer
![](https://koobas.hobune.stream/wayback/20220613003532im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do you make a mesh visible to certain cameras? 1 Answer
HDRP - Exclude wroldspace UI from post processing 0 Answers
When I se my layer #22 all objects become invisible (game view) and wireframe (sceneview) 1 Answer
Network restrictive rendering 1 Answer
Camera with background hides game 1 Answer