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