- Home /
The question is answered, right answer was accepted
Building causes bad compiler errors
Hello,
I want to make a game for PC / Android.
I have switched to PC-Platform to build the game for PC, but it gives me bad compiler-errors, even I have specified to run the code only when the Runtime-platform needs other calculation.
if(Application.platform == RuntimePlatform.Android){
Handheld.PlayFullScreenMovie(moviePath_1, Color.black, FullScreenMovieControlMode.CancelOnInput);
}
The compiler does not recognizes Handheld and FullScreenMovieControlMode, but when I built the game for Android it works.
And tell me what you think:
Is it better to have seperated projects for the same game? (one for android, one for PC, one for ...)
Answer by nisovin · Jul 20, 2015 at 11:30 PM
You'll need to use preprocessor directives to exclude that code when building for PC.
http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
#if UNITY_ANDROID
if(Application.platform == RuntimePlatform.Android){
Handheld.PlayFullScreenMovie(moviePath_1, Color.black, FullScreenMovieControlMode.CancelOnInput);
}
#endif
Follow this Question
Related Questions
Android SDK Root Folder 3 Answers
I Switched platforms and I got this errors 1 Answer
Compiler errors while switching to android 1 Answer
Compiler error while switching to android 1 Answer
Problem in android plugin creation.? 0 Answers