Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

231
Visualizações
Disable elements on pc build

I'm creating a game that I want to run on both pc and android. For android, I have a joystick that allows the player to move however on the pc you can just use WASD. Is there a way to disable a UI element on just the pc version of the game so the joystick doesn't appear on the pc version?

e.g

if(android build)
{
   Disable UI element 
}
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Unity provides list of #define directives - available at Unity docs.

Those directives allows to run pre-processor, which provide some changes to the code right before compilation/build (it is called pre-processor directives). It can optimize the code for specific platform or similar workflow/conditions. Check Microsoft docs for more details.

For your case with android, use directive UNITY_ANDROID (Unity automatically defines this directive, that is why you can use it). In code:

#if UNITY_ANDROID
    callFuncForAndroid();
#else
    callNonAndroidFunc();
#endif
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda