2
\$\begingroup\$

I'm developing an Isometric Game but I have problem apply the right layer for make, for example, a wall behind or in front of the Player depending on the Player position.

I'm able of getting works in an orthogonal map relating the y-axis value of an object with his layer but in an isometric map, the y-axis is not aligned with the editor one.

Anyone can help me understand how to manage this?

\$\endgroup\$
  • \$\begingroup\$ What is a "pg"? By the way, when you build a game in isometric perspective, using Unity in actual 3d mode with billboarding sprites might make things much easier. \$\endgroup\$ – Philipp Apr 6 '16 at 13:24
  • \$\begingroup\$ sorry is PC - Player character \$\endgroup\$ – smark91 Apr 6 '16 at 13:28
  • \$\begingroup\$ Why not use Unity's 3D and set camera to orthographic? - the result is the same and might be a lot easier if you're not worried about pixel-perfection. \$\endgroup\$ – Engineer Apr 6 '16 at 13:34
  • \$\begingroup\$ @ArcaneEngineer Even in 3d mode you could get pixel-perfection by using a shader without texture filtering. \$\endgroup\$ – Philipp Apr 6 '16 at 13:43
  • \$\begingroup\$ @ArcaneEngineer but how to get the 3d effect? \$\endgroup\$ – smark91 Apr 6 '16 at 13:50
0
\$\begingroup\$

One solution is to build your world in 3D, then set the specific camera angle you want to look down on the level (isometric or any flavour thereof), and set the camera angle to orthographic.

\$\endgroup\$
  • \$\begingroup\$ For using a 3d world I need to implement the sprites in a mesh, is correct? \$\endgroup\$ – smark91 Apr 7 '16 at 16:29
  • \$\begingroup\$ @smark91 Yes, your surroundings would need to represented as meshes. However your characters could still be represented as flat sprites. You could build very simple shapes to do the job for your terrain and buildings. \$\endgroup\$ – Engineer Apr 7 '16 at 17:59
1
\$\begingroup\$

There are two methods that can work.

Method I

  1. Go To Graphics Settings

    Edit > Project Settings > Graphics

  2. Under Camera Settings Change Transparency Sort Mode from default to Custom Axis.
  3. Now Change Transparency Sort Axis Z value to 0 and Y value to 1.
  4. Now it will take care of you Sprite Renderer's layering (according to Y axis value).
  5. You can also use Sorting Group Component to group multiple sprites to together.

Method II

  1. You can define multiple sorting layers in unity e.g. player, walls, tile map etc.

    Edit > Project Settings > Tags & Layers

  2. Inspector you can find Sorting Layers Menu
  3. You can find your defined sorting layers in each Sprite Renders Component or in case you are using UGUI Canvas component.

  4. If you are using Tile Map Make you on grid and change you sorting order of player according to grid cell index.

  5. You can define any function to calculate your sorting index.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.