Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

209
Vistas
Sprites with different z values not rendering in correct order

Starting off with some 2D in Unity. I am running 2019.4.12f1. I am following the "Let's Make Solitaire in Unity" by Megalomobile. I am dealing out the cards with the code:

IEnumerator SolitairDeal()
    {
        for (var i = 0; i < 7; i++)
        {
            var yoff = 0.0f;
            var zoff = 0.03f;
            foreach (var c in bottoms[i])
            {
                yield return new WaitForSeconds(0.1f);
                GameObject newCard = Instantiate(cardPrefab, new Vector3(bottomPos[i].transform.position.x, bottomPos[i].transform.position.y - yoff, bottomPos[i].transform.position.z - zoff), Quaternion.identity, bottomPos[i].transform);
                newCard.name = c;
                newCard.GetComponent<Selectable>().faceUp = c == bottoms[i][bottoms[i].Count - 1];

                yoff += 0.3f;
                zoff += 0.03f;
            }
        }
    }

When it renders in game mode I get this: enter image description here

If I switch to Scene mode to inspect the z values, they are correct and everything is properly rendered:enter image description here

I can increase the zoff value but as I do so, I am getting a good deal of parallax which I do not want. I have looked for creating a camera that eliminated parallax, but could not find one. I thought of using tags but managing that would get cumbersome depending on how many cards are in each stack.

Thank you in advance for any help.

EDIT: Thanks to the reference from @derHugo below I have found the fix. First, I changed the camera to Orthographic. Second I also had to change the camera's depth. Apparently if the depth is negative, it is still Perspective.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda