Search Unity

Feedback Isnt unity cross platform?

Discussion in 'General Discussion' started by WirealTalha, Nov 7, 2020.

  1. WirealTalha

    WirealTalha

    Joined:
    Jul 19, 2018
    Posts:
    142
    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
    1. foreach (FileInfo file in fileInfo) {
    2. // file name check
    3. if (file.Name == "something") {
    4. ...
    5. }

    Am i missing something? is the unity not cross platform?
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,775
    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.
     
    WirealTalha likes this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,175
    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.
     
    Last edited: Nov 7, 2020
    MadeFromPolygons and WirealTalha like this.
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    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.
     
    Last edited: Nov 8, 2020
    WirealTalha likes this.
  5. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    Along with what everyone else has posted, I'm not sure how this...
    ...Relates to your cross-platform question.
     
    WirealTalha likes this.
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    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.

    Was this meant to be "can't"?
     
    Ryiah, WirealTalha and neginfinity like this.
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,569
    Yep. Fixed.
     
    angrypenguin likes this.
  8. WirealTalha

    WirealTalha

    Joined:
    Jul 19, 2018
    Posts:
    142
    Thanks Alot Guys For your help. I understand it better now. :)
     
  9. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    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.