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

230
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
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