Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

How do I fix crossed sprites

Discussion in '2D' started by IIITom, May 19, 2022.

  1. IIITom

    IIITom

    Joined:
    Sep 30, 2019
    Posts:
    2
    I've been working on a pokemon game. I used a 2D tilemap for the roads and stuff, and 3D objects for stuff such as collisions, like houses. I've been messing around with trees and came up with something that I think will look nice:

    upload_2022-5-19_17-45-1.png

    But as you can see; the sprites I use are kind of see through and I have no clue how to fix this.
    these are the sprite settings:

    upload_2022-5-19_17-46-41.png
     
  2. Unrighteouss

    Unrighteouss

    Joined:
    Apr 24, 2018
    Posts:
    599
    Hello,

    I could be wrong about this, but I'm pretty sure sprites always render two-dimensionally (one over another). If you want to cross sprites in 3D space like that, I think you're better off using planes with materials/textures.
     
    Kurt-Dekker likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,970
    Don't think you can get there with SpriteRenderer. Read more below.

    You might be able to do it with SpriteRenderer if you swap out the Material for one that has z-depth testing, perhaps Unlit Cutout Texture.

    EDIT: I just checked and yes, the Unlit/Transparent Cutout Material (just make an instance of one) will work if you slot it into the two SpriteRenderers.

    Screen Shot 2022-05-19 at 11.31.21 AM.png Screen Shot 2022-05-19 at 11.31.26 AM.png

    Three (3) ways that Unity draws / stacks / sorts / layers / overlays stuff:

    https://forum.unity.com/threads/orthographic-camera-rendering-order.1114078/#post-7167037

    In short,

    1. The default 3D Renderers draw stuff according to Z depth - distance from camera.

    2. SpriteRenderers draw according to their Sorting Layer and Sorting Depth properties

    3. UI Canvas Renderers draw in linear transform sequence, like a stack of papers

    If you find that you need to mix and match items using these different ways of rendering, and have them appear in ways they are not initially designed for, you need to:

    - identify what you are using
    - search online for the combination of things you are doing and how to to achieve what you want.

    There may be more than one solution to try.

    Additional reading in the official docs:

    https://docs.unity3d.com/Manual/2DSorting.html
     
    Unrighteouss likes this.
  4. IIITom

    IIITom

    Joined:
    Sep 30, 2019
    Posts:
    2
    Thanks alot this worked!