- Home /
desktop,ios and android script differences??
Hi, everyone
i m wondering is there any scripting difference between desktop ios and android scripts.
according to me the main difference is touch scripts desktop and touch devices. but can i use same touch script on ios and android.
looking forward for your help.
thanx
Answer by CC Inc · Mar 17, 2012 at 02:10 PM
Here is this from the iOS getting started page:
Unity's iOS and Desktop Targets Differ Statically Typed JavaScript
Dynamic typing in JavaScript is always turned off in Unity when targetting iOS (this is equivalent to #pragma strict getting added to all your scripts automatically). Static typing greatly improves performance, which is especially important on iOS devices. When you switch an existing Unity project to the iOS target, you will get compiler errors if you are using dynamic typing. You can easily fix these either by using explicitly declared types for the variables that are causing errors or taking advantage of type inference. MP3 Instead of Ogg Vorbis Audio Compression
For performance reasons, MP3 compression is favored on iOS devices. If your project contains audio files with Ogg Vorbis compression, they will be re-compressed to MP3 during the build. Consult the audio clip documentation for more information on using compressed audio on the iPhone. PVRTC Instead of DXT Texture Compression
Unity iOS does not support DXT textures. Instead, PVRTC texture compression is natively supported by iPhone/iPad devices. Consult the texture import settings documentation to learn more about iOS texture formats. Movie Playback
MovieTextures are not supported on iOS. Instead, full-screen streaming playback is provided via scripting functions. To learn about the supported file formats and scripting API, consult the movie page in the manual.
And from the android page:
How Unity Android Differs from Desktop Unity Strongly Typed JavaScript
For performance reasons, dynamic typing in JavaScript is always turned off in Unity Android, as if #pragma strict were applied automatically to all scripts. This is important to know if you start with a project originally developed for the desktop platforms since you may find you get unexpected compile errors when switching to Android; dynamic typing is the first thing to investigate. These errors are usually easy to fix if you make sure all variables are explicitly typed or use type inference on initialization. ETC as Recommended Texture Compression
Although Unity Android does support DXT/PVRTC/ATC textures, Unity will decompress the textures into RGB(A) format at runtime if those compression methods are not supported by the particular device in use. This could have an impact on the GPU rendering speed and it is recommended to use the ETC format instead. ETC is the de facto standard compression format on Android, and should be supported on all post 2.0 devices. However, ETC does not support an alpha channel and RGBA 16-bit will sometimes be the best trade-off between size, quality and rendering speed where alpha is required.
It is also possible to create separate android distribution archives (.apk) for each of the DXT/PVRTC/ATC formats, and let the Android Market's filtering system select the correct archives for different devices (see Publishing Builds for Android). Movie Playback
Movie textures are not supported on Android, but a full-screen streaming playback is provided via scripting functions. To learn about supported file formats and scripting API, consult the movie page or the Android supported media formats page.
Hope it helps!
Hi ,@coolguyxp
I already read this in getting started with ios and android. I m new to scripting.
I made one level in 3d platform, now i want it in android or ios. so i want to know that do i have to re-script all scripts ?
thanx for replay.
Scripting-wise, the most important difference is that you can't use JavaScript's dynamic typing system on mobile.
(On the other hand, you probably shouldn't be using it, either way.)
You can simulate/force this by adding the following line to the top of any JavaScript files:
#pragma strict
i recently just switched my project from pc to ios due to the marvellous free upgrade i was going to buy very soon haha,
but all i noticed in switching $$anonymous$$e was i had several errors come up in my script and they were only to change any varible not assigned as a varible and taking all the components out of ("")
apart from the best part of an hour sorting my scripts very easy, cant say for android.
Those are pretty common changes, yeah. It's really mostly stuff you're better off doing to begin with, even if it does make things slightly harder to work with.
Unless you're doing something "fancy", most of your code should be pretty much the same between Android or iOS.
Answer by CC Inc · Mar 28, 2012 at 10:21 PM
No, I think the android and iOS scripting is the same, so you should be good to go.