I always thought unity was cross platform, I.e one build for ios and android. I am developing my first ever game, to be released on both ios and android.
I keep on seeing the questions in different formus for different issues “does it work with ios” OR
“Does it work with android”?
Why are ppl asking these questions. recently I saw this question pop up when I was searching for the solution of how to check the files names in a directory. How to get the names of all the files in a specific directory by giving only its path.
the answer was
foreach (FileInfo file in fileInfo) {
// file name check
if (file.Name == “something”) {
…
}
Am i missing something? is the unity not cross platform?
You need choose target platform, when you build yor game.
So if you target for example win, iOS and Android, you need do 3 builds, one for each platform you want to support.
Unity is cross-platform but you need to make a build for each platform because each platform handles just about everything differently from the format that the executable has to be in to the actual device functionality. For the most part these are handled for you.
For cases where they are not handled for you it’s typically because there are multiple ways to do it all with their own advantages and disadvantages depending on the situation and you wouldn’t want them choosing for you.
For a game engine that is designed to hold your hand at every step (eg Game Maker) it wouldn’t be a problem if it chooses for you, but Unity is a game engine designed first and foremost for professional game developers.
With that out of the way the people who are asking these questions are simply doing so out of some combination of ignorance and laziness. You’d be surprised, for example, how many people create posts are answered by the front page of this website or by a thread that was visible to them at the time they created theirs.
Doesn’t work this way. You can’t have the same BUILD (a binary) to work on multiple platforms. You’ll need to switch target platform and build for the new target.
It’s possible that you’re misunderstanding the term “build”.
When you create a project, put content in it, make levels, write scripts, etc. that’s not a “build”, that’s the “source”. A project’s source doesn’t run on its own, it only works in the Editor. When you convert that to a thing which can be run on its own that’s creating a “build”. As others have already said, you need to do that bit once per platform.
But you can have one project from which you create builds for multiple platforms. That’s what is meant when people say that Unity is “cross platform”.
Unfortunately, for some things different platforms are just outright incompatible regardless of how much Unity might help us out. The question you saw about file access is probably because different platforms can have fundamentally different rules about that, which might necessitate writing a little custom code for each.
I think it does, because different target platforms have different filesystem restrictions. For example, I don’t think you can provide absolute file system paths and expect it to work if you are building for WebGL, or if you are providing a path on IOS/Android outside of where your App should be messing around. While on Standalone you can access files anywhere so long as the user account has access.