- Home /
How do you change meshes between different target platforms?
The game I am currently working on is targeted at both desktop and iOS, but of course I would like to keep my tri's down on the iOS platform. How would I be able to specify a different mesh to be used for a character when running on the iOS platform as opposed to the desktop?
Good question. Love to see the answer for this considering Unity is targeting multiple platforms.
Answer by gtjuggler · Nov 01, 2011 at 04:47 AM
Meshes can be swapped per-platform using my simple example in this thread here: http://forum.unity3d.com/threads/108637-MultiPlatform-ToolKit-Multiplatform-development-simplified.?p=727256&viewfull=1#post727256
That kind of swapping doesn't require the MultiPlatform ToolKit, but using its platform defines helps to clearly and simply determine which platform you'd like to spawn what mesh.
Answer by Dwair · Dec 22, 2010 at 03:12 PM
Mmhh, interesting issue...
I suppose you could do many things like using a function that chooses depending the compilation method on a switch statement asking for application.platform property and then instantiating the right mesh, or even better, an entire prefab with mesh textures and other things adapted to iOS (I make something like that myself when developing iPhone/iPad/retina games).
But is it really necessary for your game? I mean, one is a big resourceful machine and the other one has limited space/performance resources. And more important, mobile users are most concerned about binary size.
If you're only concerned in polycount issues, you could try to use mesh.optimize for reducing triangles, but I personally didn't tried it yet in iPhone, and probably won't strip down that much for the requirements of iOS machines...
Anyway, multiplatform is always an issue, but trying to "one-size-fits-all" everything on the pipeline probably will end with a too-big, too-slow game, and we don't want that, right? ;)
It seems strange to me that there isn't a default way in the editor to specify a mesh for a specific platform. In the case of the game I am working on, it is fairly important seeing that there can be 15-20 characters on screen at once. In the case of the iOS I need to keep the visible vertex count below 10$$anonymous$$, and if possible for Desktop I would like to use characters with a vertex count over 1$$anonymous$$.
Yes, my point exactly! There's just too much differences between platforms and will need different meshes. The point is when copying files to assets folder, you'll load all those files in each binary, when in reality you'll only always use one mesh...so as long as we don't have a method to compile different assets folders for different platforms (as far as I'm aware) our only option is using dynamic load in Start() functions, and risking to use too much space for a iPhone game.