Call several functions only on android ?

Hello,

can I call functions only when the App is running on android?
I got an App that I export as Windows and as Android app and I’d like to call some stuff only on Windows and others only on android but I want everything in one package without having to do this as 2 projects, is there a way ?

thanks!

What you want is this

Just to be sure

#if UNITY_ANDROID
public void blafoo(){
//super cool code
}
#endif

Is already enough? That easy ?

Yeah, pretty much. It will only include the code needed for the platform you are on when you do your build. You’ll actually see the code grey out if it’s not the proper platform.