Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!