@@ -82,25 +82,26 @@ private static void BuildPlayer(string defaultBuildPath, bool setupForAltTester
8282 EditorApplication . Exit ( 1 ) ;
8383 }
8484
85+ // Restore Build Profile to original state (empty scenes)
86+ Debug . Log ( "Restoring Build Profile to original state..." ) ;
87+ buildProfile . scenes = new EditorBuildSettingsScene [ 0 ] ;
88+ EditorUtility . SetDirty ( buildProfile ) ;
89+ AssetDatabase . SaveAssets ( ) ;
90+ Debug . Log ( "Build Profile restored" ) ;
91+
8592 if ( setupForAltTester )
86- {
87- Debug . Log ( "=== Cleaning up AltTester settings after build ===" ) ;
88-
93+ {
8994 // Clean up AltTester settings after build
90- Debug . Log ( "Removing AltTester from scripting define symbols..." ) ;
9195 AltBuilder . RemoveAltTesterFromScriptingDefineSymbols ( BuildTargetGroup . Standalone ) ;
9296
9397 // Clean up custom e2e testing define
94- Debug . Log ( "Removing IMMUTABLE_E2E_TESTING define symbol..." ) ;
9598 var defineSymbols = PlayerSettings . GetScriptingDefineSymbolsForGroup ( BuildTargetGroup . Standalone ) ;
9699 defineSymbols = defineSymbols . Replace ( "IMMUTABLE_E2E_TESTING;" , "" ) . Replace ( ";IMMUTABLE_E2E_TESTING" , "" ) . Replace ( "IMMUTABLE_E2E_TESTING" , "" ) ;
97100 PlayerSettings . SetScriptingDefineSymbolsForGroup ( BuildTargetGroup . Standalone , defineSymbols ) ;
98101
99102 var cleanedDefineSymbols = PlayerSettings . GetScriptingDefineSymbolsForGroup ( BuildTargetGroup . Standalone ) ;
100- Debug . Log ( $ "Cleaned scripting define symbols: { cleanedDefineSymbols } ") ;
101103
102104 RemoveAltFromScene ( scenes [ 0 ] ) ;
103- Debug . Log ( "✅ AltTester cleanup completed" ) ;
104105 }
105106 }
106107 catch ( Exception exception )
@@ -123,106 +124,6 @@ private static string GetBuildPathFromArgs(string defaultBuildPath)
123124 return defaultBuildPath ;
124125 }
125126
126- private static void ValidateBuildProfile ( BuildProfile buildProfile )
127- {
128- Debug . Log ( $ "Build Profile Debug Info:") ;
129- Debug . Log ( $ " - Name: { buildProfile . name } ") ;
130-
131- // Use reflection to get available properties since API might vary
132- var type = buildProfile . GetType ( ) ;
133- Debug . Log ( $ " - Type: { type . Name } ") ;
134-
135- // Try to get common BuildProfile properties
136- try
137- {
138- var buildTargetProperty = type . GetProperty ( "buildTarget" ) ;
139- if ( buildTargetProperty != null )
140- {
141- Debug . Log ( $ " - Build Target: { buildTargetProperty . GetValue ( buildProfile ) } ") ;
142- }
143-
144- var subtargetProperty = type . GetProperty ( "subtarget" ) ;
145- if ( subtargetProperty != null )
146- {
147- Debug . Log ( $ " - Subtarget: { subtargetProperty . GetValue ( buildProfile ) } ") ;
148- }
149-
150- var platformIdProperty = type . GetProperty ( "platformId" ) ;
151- if ( platformIdProperty != null )
152- {
153- Debug . Log ( $ " - Platform ID: { platformIdProperty . GetValue ( buildProfile ) } ") ;
154- }
155-
156- var overrideGlobalSceneListProperty = type . GetProperty ( "overrideGlobalSceneList" ) ;
157- if ( overrideGlobalSceneListProperty != null )
158- {
159- Debug . Log ( $ " - Override Global Scene List: { overrideGlobalSceneListProperty . GetValue ( buildProfile ) } ") ;
160- }
161- }
162- catch ( System . Exception ex )
163- {
164- Debug . LogWarning ( $ " - Could not access some BuildProfile properties: { ex . Message } ") ;
165- }
166-
167- Debug . Log ( $ " - Scenes Count: { ( buildProfile . scenes ? . Length ?? 0 ) } ") ;
168-
169- if ( buildProfile . scenes != null && buildProfile . scenes . Length > 0 )
170- {
171- Debug . Log ( $ " - Scenes:") ;
172- for ( int i = 0 ; i < buildProfile . scenes . Length ; i ++ )
173- {
174- Debug . Log ( $ " [{ i } ] { buildProfile . scenes [ i ] } ") ;
175- }
176- }
177- else
178- {
179- Debug . LogWarning ( " - Build Profile has no scenes configured" ) ;
180- }
181-
182- Debug . Log ( $ " - Scripting Defines Count: { ( buildProfile . scriptingDefines ? . Length ?? 0 ) } ") ;
183- if ( buildProfile . scriptingDefines != null && buildProfile . scriptingDefines . Length > 0 )
184- {
185- Debug . Log ( $ " - Scripting Defines: { string . Join ( ", " , buildProfile . scriptingDefines ) } ") ;
186- }
187-
188- // Check symlink status
189- Debug . Log ( $ "Symlink Status Check:") ;
190- string scenesPath = "Assets/Scenes" ;
191- if ( System . IO . Directory . Exists ( scenesPath ) )
192- {
193- Debug . Log ( $ " - Scenes directory exists: { scenesPath } ") ;
194- try
195- {
196- var scenesDir = new System . IO . DirectoryInfo ( scenesPath ) ;
197- if ( scenesDir . Attributes . HasFlag ( System . IO . FileAttributes . ReparsePoint ) )
198- {
199- // Use reflection for LinkTarget since it might not be available on all platforms
200- var linkTargetProperty = scenesDir . GetType ( ) . GetProperty ( "LinkTarget" ) ;
201- if ( linkTargetProperty != null )
202- {
203- Debug . Log ( $ " - Scenes is a symlink: { linkTargetProperty . GetValue ( scenesDir ) } ") ;
204- }
205- else
206- {
207- Debug . Log ( $ " - Scenes is a symlink (LinkTarget property not available)") ;
208- }
209- }
210- else
211- {
212- Debug . Log ( $ " - Scenes is a regular directory") ;
213- }
214- }
215- catch ( System . Exception ex )
216- {
217- Debug . LogWarning ( $ " - Could not check symlink status: { ex . Message } ") ;
218- }
219- }
220- else
221- {
222- Debug . LogError ( $ " - Scenes directory does not exist: { scenesPath } ") ;
223- }
224- }
225-
226127 private static string [ ] GetScenesToBuild ( bool setupForAltTester = false )
227128 {
228129 return new [ ]
@@ -241,62 +142,32 @@ private static string[] GetScenesToBuild(bool setupForAltTester = false)
241142
242143 private static void SetupAltTester ( string [ ] scenes )
243144 {
244- Debug . Log ( "=== Setting up AltTester for build ===" ) ;
245-
246- // Add AltTester scripting define symbols
247- Debug . Log ( "Adding AltTester to scripting define symbols..." ) ;
248145 AltBuilder . AddAltTesterInScriptingDefineSymbolsGroup ( BuildTargetGroup . Standalone ) ;
249146
250147 var defineSymbols = PlayerSettings . GetScriptingDefineSymbolsForGroup ( BuildTargetGroup . Standalone ) ;
251- Debug . Log ( $ "Current scripting define symbols: { defineSymbols } ") ;
252-
253- // Add custom define for e2e testing to enable default browser behavior
254148 if ( ! defineSymbols . Contains ( "IMMUTABLE_E2E_TESTING" ) )
255149 {
256- Debug . Log ( "Adding IMMUTABLE_E2E_TESTING define symbol..." ) ;
257150 defineSymbols += ";IMMUTABLE_E2E_TESTING" ;
258151 PlayerSettings . SetScriptingDefineSymbolsForGroup ( BuildTargetGroup . Standalone , defineSymbols ) ;
259- defineSymbols = PlayerSettings . GetScriptingDefineSymbolsForGroup ( BuildTargetGroup . Standalone ) ;
260- Debug . Log ( $ "Updated scripting define symbols: { defineSymbols } ") ;
261- }
262- else
263- {
264- Debug . Log ( "IMMUTABLE_E2E_TESTING define symbol already present" ) ;
265152 }
266153
267- Debug . Log ( "Creating JSON file for input mapping of axis..." ) ;
268154 AltBuilder . CreateJsonFileForInputMappingOfAxis ( ) ;
269155
270156 var instrumentationSettings = new AltInstrumentationSettings ( ) ;
271157 var host = System . Environment . GetEnvironmentVariable ( "ALTSERVER_HOST" ) ;
272158 if ( ! string . IsNullOrEmpty ( host ) )
273159 {
274- Debug . Log ( $ "Using custom AltServer host from environment: { host } ") ;
275160 instrumentationSettings . AltServerHost = host ;
276161 }
277- else
278- {
279- Debug . Log ( $ "Using default AltServer host: { instrumentationSettings . AltServerHost } ") ;
280- }
281162
282163 var port = System . Environment . GetEnvironmentVariable ( "ALTSERVER_PORT" ) ;
283164 if ( ! string . IsNullOrEmpty ( port ) )
284165 {
285- Debug . Log ( $ "Using custom AltServer port from environment: { port } ") ;
286166 instrumentationSettings . AltServerPort = int . Parse ( port ) ;
287167 }
288- else
289- {
290- instrumentationSettings . AltServerPort = 13000 ;
291- Debug . Log ( $ "Using default AltServer port: 13000") ;
292- }
293168
294169 instrumentationSettings . ResetConnectionData = true ;
295- Debug . Log ( $ "AltTester instrumentation settings: Host={ instrumentationSettings . AltServerHost } , Port={ instrumentationSettings . AltServerPort } , ResetConnectionData={ instrumentationSettings . ResetConnectionData } ") ;
296-
297- Debug . Log ( $ "Inserting AltTester prefab into first scene: { scenes [ 0 ] } ") ;
298170 AltBuilder . InsertAltInScene ( scenes [ 0 ] , instrumentationSettings ) ;
299- Debug . Log ( "✅ AltTester setup completed successfully" ) ;
300171 }
301172
302173 public static void RemoveAltFromScene ( string scene )
0 commit comments