Logo my studio is game, portfólio is developer game

Ternarias conditions in Unity

The se of conditions for the development of games is something common, especially the IF and else. But we can sophisticate our programming, leaving the code more readable and with less line of code. 

Using IF and else: 

if(contagemDosBlocos == 0)
{
 idPorta = 2;
}
else
{
  idPorta = 1;
}

Using a Ternaria condition: 

idPorta = contagemDosBlocos == 0 ? 2 : 1;

Make contact!

Did you like this content? Let's talk...

I'm a game developer, I use unity. If you want to develop something, tell me!