- Home /
Application.isMobile() equivalent of Application.isWebPlayer() ?
Is there a isMobile() equivalent of isWebPlayer() for telling when the app is being run on a mobile device?
Answer by Jessy · Dec 30, 2010 at 06:32 AM
No, and I don't think isWebPlayer would have existed, had OTEE been more ambitious from the start. Application.platform will tell you what you need.
Answer by NewfieJoe · Apr 21, 2011 at 06:25 AM
You can add it if you like.
function isMobile() {
if (Application.platform == RuntimePlatform.IPhonePlayer ||
Application.platform == RuntimePlatform.Android)
return true;
else
return false;
}
The docs show you how to differentiate between all the platforms. Handy for debugging since you can toggle debug messages on when running in the editor only and output them to a debug log file for builds.
Your answer
Follow this Question
Related Questions
Deploying to Android or iPhone device - track public variables in inspector? 1 Answer
iOS application in the settings panel 3 Answers
signal 11 (SIGSEGV), fault 2 Answers
"More Games" button on mobile? 1 Answer
What do i need to run my built application for iphone using unity to be run on android devices 1 Answer