- Home /
Use same code for iOS, Android and Web Player
Hello
Is it possible to write one Unity3D application that will work across Unity Web Player, Android and iOS?
I am thinking that maybe I could write my Application in C# and for the Unity Web Player I insert the C# code inside a script element. Given I have the iOS and Android extensions is this possible to do this or will I have to write 3 different applications? Can I write a Unity3D application for iOS all in C#? Can I write a Unity3D application for Android all in C#?
Are there plans in the future to deploy Unity Web App to Safari-iOS and Android-Web-Browser?
Could I really get my one application codebase to work across all 3 platforms?
For the Web Player only I would deploy it like so...
<html>
<head>
<script language="C#" type="text/C#">
// my C# code that works for iOS, Android and Web Player
</script>
</head>
<body>
<center>
<object id="UnityObject" width="600" height="450" classid="clsid:...">
</center>
</body>
</html>
Answer by DaveA · Apr 12, 2012 at 09:31 AM
Yeah, it's possible to use the same code on all platforms, but you may run into some problems depending on what you are doing, as each platform has its own challenges. Web player can't read/write local files. Mobile probably going to use a touch-based UI. But most of the code is portable. I doubt they will put a mobile web player on either phone, as they already have native players for those devices. Unless they ever export to HTML5. But for now, you'd just build as web, or iOS, or Android, and deploy as required by each platform.
@Dave A. thanks for the quick reply :) What do you mean that most of the code is portable? On Web Player can I read files on the domain server or from over the internet(a different url to the current domain)?
@jake$$anonymous$$: you can read files using the WWW class: http://unity3d.com/support/documentation/ScriptReference/WWW.html - if it's from a different domain, it'll need to have a crossdomain.xml policy file.
Your answer
Follow this Question
Related Questions
Adding animations to a a bought FBX 0 Answers
Cloud recognition in Vuforia 0 Answers
3d UI Using plane For all screens 0 Answers
Unity iPhone app size is too big 1 Answer
Camera Rotation Probleme with iPhone 0 Answers