- Home /
How to develop a unity project for cross-platform(Windows-Standalone and Android) with some features which differ across platforms ?
I had a project initially developed for Windows platform. When I wanted it for Android platform, for safe-side I made a copy of whole project and changed to Android Platform.
Due to some performance issues, I had to make some changes in scene in Android platform to reduce drawCalls and polygons count and optimized UI canvases. As few functions in scripts are platform specific, I had used #define directives to achieve Platform dependent compilation. At last I got it working in Android platform with decent performance and added some new features in Android platform.
Later for few months, I continued to develop in my Windows platform project. Now, I wanted my latest version of project to Android platform as well. I had made a lot of changes in scene as well as scripts in my new version when compared to earlier version. I don't understand on how to convert it now to Android platform. Also each time when I wanted to switch this platform, it's taking me approximately 6 hours of time to build the library because of the change in platform.
Can anyone please recommend/suggest me a solution for this which can be achieved in less time and with less human-error ?
2 solutions that popped in my $$anonymous$$d are,
1. Do it manually again by creating a copy for Android platform and make all optimizations and changes in scripts again. It's a tedious task and there is more scope for human error.
2. Wanted to merge the latest version of Windows platform project to already existing Android platform project. But I am not sure of how those changes in scene turn out, as there are many reference elements of gameObjects in scenes to inspector of few scripts. I am afraid that, they all become messy. And in scripting also with the usage of these platform specific directives I ended with some errors as well. Because when building for 1 platform the code inside other platform directive doesn't show any function call references and compile time errors as that code is greyed out and not compiled. With this solution I have to make a hit and try and keep fixing the runtime errors that I get in play$$anonymous$$ode.