@@ -16,7 +16,8 @@ class UXFBuildPreprocessor : IProcessSceneWithReport
1616 BuildTarget . StandaloneLinux64 ,
1717 BuildTarget . StandaloneOSX ,
1818 BuildTarget . StandaloneWindows ,
19- BuildTarget . StandaloneWindows64
19+ BuildTarget . StandaloneWindows64 ,
20+ BuildTarget . Android
2021 } ;
2122
2223 public void OnProcessScene ( Scene scene , BuildReport report )
@@ -28,14 +29,23 @@ public void OnProcessScene(Scene scene, BuildReport report)
2829 . GetRootGameObjects ( )
2930 . SelectMany ( go => go . GetComponentsInChildren < UXF . UI . UIController > ( true ) ) ;
3031
32+ string expected ;
33+ #if UNITY_2020_1_OR_NEWER
34+ expected = "PROJECT:UXF WebGL 2020" ;
35+ #else
36+ expected = "PROJECT:UXF WebGL 2019" ;
37+ #endif
38+
39+ // check webGL
3140 if ( report . summary . platform == BuildTarget . WebGL &&
32- PlayerSettings . WebGL . template != "PROJECT:UXF WebGL" )
41+ PlayerSettings . WebGL . template != expected )
3342 {
3443 Utilities . UXFDebugLogWarning ( "The UXF WebGL template is not selected in WebGL player settings! This may lead to errors. You can fix the is with the UXF Wizard (press UXF at the top, Show UXF Wizard)." ) ;
3544 }
3645
3746 foreach ( var ui in uis )
3847 {
48+ // check local file access requirement
3949 var localHandlers = ui . ActiveLocalFileDataHandlers ;
4050 if ( localHandlers . Count ( ) > 0 && ! localFileDataHandlerCompatiblePlatforms . Contains ( report . summary . platform ) )
4151 {
@@ -50,8 +60,8 @@ public void OnProcessScene(Scene scene, BuildReport report)
5060 localHandlers . Count ( ) == 1 ? "s" : ""
5161 ) ) ;
5262 }
53-
54-
63+
64+ // check UI
5565 if ( ui . settingsMode == UI . SettingsMode . AcquireFromUI && ! localFileDataHandlerCompatiblePlatforms . Contains ( report . summary . platform ) )
5666 {
5767 CancelBuild ( string . Format (
@@ -63,6 +73,7 @@ public void OnProcessScene(Scene scene, BuildReport report)
6373 ) ) ;
6474 }
6575
76+ // manually test for data handlers that are not compatible with the build target
6677 Session session = ui . GetComponentInParent < Session > ( ) ;
6778 foreach ( var dh in session . ActiveDataHandlers )
6879 {
@@ -87,6 +98,43 @@ public void OnProcessScene(Scene scene, BuildReport report)
8798 ) ;
8899 }
89100 }
101+
102+ // check android
103+ if ( report . summary . platform == BuildTarget . Android )
104+ {
105+ foreach ( var dh in session . ActiveDataHandlers )
106+ {
107+ if ( dh is FileSaver )
108+ {
109+ var fileSaver = dh as FileSaver ;
110+
111+ // check android must be set to persistent data path
112+ if ( fileSaver . dataSaveLocation != DataSaveLocation . PersistentDataPath )
113+ {
114+ CancelBuild ( string . Format (
115+ "Cannot build scene {0} for platform '{1}'.\n Reason: To use the Data Handler '{2}' with {1} " +
116+ "you must set the Data Save Location to '{3}'. Data will then be stored on the internal file system." ,
117+ scene . name ,
118+ report . summary . platform ,
119+ fileSaver . name ,
120+ DataSaveLocation . PersistentDataPath
121+ ) ) ;
122+ }
123+
124+ // check external SD card access is set in player settings
125+ if ( ! PlayerSettings . Android . forceSDCardPermission )
126+ {
127+ CancelBuild ( string . Format (
128+ "Cannot build scene {0} for platform '{1}'.\n Reason: To use the Data Handler '{2}' you must set the Write Permission " +
129+ "in the Player Settings to 'External (SDCard)'." ,
130+ scene . name ,
131+ report . summary . platform ,
132+ fileSaver . name
133+ ) ) ;
134+ }
135+ }
136+ }
137+ }
90138 }
91139 }
92140
0 commit comments