@@ -20,19 +20,17 @@ class BuildDataInputFile
2020 public string path ;
2121 public string contentHash ;
2222
23- public BuildDataInputFile ( NPath npath )
23+ public BuildDataInputFile ( NPath npath , bool developmentBuild )
2424 {
2525 path = npath . ToString ( ) ;
2626 if ( npath . HasExtension ( "cs" ) )
2727 {
2828 var monoScript = AssetDatabase . LoadAssetAtPath < MonoScript > ( path ) ;
2929 if ( monoScript != null )
30- contentHash = monoScript . GetPropertiesHashString ( ) ;
30+ contentHash = monoScript . GetPropertiesHashString ( developmentBuild ) ;
3131 }
3232 else
33- {
3433 contentHash = AssetDatabase . GetAssetDependencyHash ( npath . ToString ( ) ) . ToString ( ) ;
35- }
3634 }
3735 }
3836
@@ -68,19 +66,17 @@ bool CheckAssetDirty(BuildDataInputFile file)
6866 return true ;
6967 }
7068
71- string hash = "" ;
69+ string contentHash = "" ;
7270 if ( path . Extension == "cs" )
7371 {
7472 var monoScript = AssetDatabase . LoadAssetAtPath < MonoScript > ( path . ToString ( ) ) ;
7573 if ( monoScript != null )
76- hash = monoScript . GetPropertiesHashString ( ) ;
74+ contentHash = monoScript . GetPropertiesHashString ( buildOptions . HasFlag ( BuildOptions . Development ) ) ;
7775 }
7876 else
79- {
80- hash = AssetDatabase . GetAssetDependencyHash ( path . ToString ( ) ) . ToString ( ) ;
81- }
77+ contentHash = AssetDatabase . GetAssetDependencyHash ( file . path ) . ToString ( ) ;
8278
83- if ( hash != file . contentHash )
79+ if ( contentHash != file . contentHash )
8480 {
8581 Console . WriteLine ( $ "Rebuilding Data files because { path } is dirty (hash)") ;
8682 return true ;
@@ -103,7 +99,7 @@ bool DoCheckDirty()
10399 return true ;
104100 }
105101
106- if ( buildOptions != buildData . buildOptions )
102+ if ( ( buildOptions & BuildData . BuildOptionsMask ) != buildData . buildOptions )
107103 {
108104 Console . WriteLine ( "Rebuilding Data files because the build options have changed" ) ;
109105 return true ;
@@ -147,22 +143,23 @@ bool DoCheckDirty()
147143 [ RequiredByNativeCode ]
148144 static public void WriteBuildData ( string buildDataPath , BuildReport report , string [ ] scenes , string [ ] prefabs )
149145 {
146+ var developmentBuild = report . summary . options . HasFlag ( BuildOptions . Development ) ;
150147 var inputScenes = new List < BuildDataInputFile > ( ) ;
151148 foreach ( var scene in scenes )
152- inputScenes . Add ( new BuildDataInputFile ( scene ) ) ;
149+ inputScenes . Add ( new BuildDataInputFile ( scene , developmentBuild ) ) ;
153150
154151 var inputFiles = new List < BuildDataInputFile > ( ) ;
155152 foreach ( var scene in scenes )
156- inputFiles . Add ( new BuildDataInputFile ( scene ) ) ;
153+ inputFiles . Add ( new BuildDataInputFile ( scene , developmentBuild ) ) ;
157154 foreach ( var prefab in prefabs )
158- inputFiles . Add ( new BuildDataInputFile ( prefab ) ) ;
155+ inputFiles . Add ( new BuildDataInputFile ( prefab , developmentBuild ) ) ;
159156 foreach ( var assetInfo in report . packedAssets . SelectMany ( a => a . contents ) )
160157 {
161158 if ( assetInfo . sourceAssetPath . ToNPath ( ) . FileExists ( ) && ! assetInfo . sourceAssetPath . StartsWith ( "." ) )
162- inputFiles . Add ( new BuildDataInputFile ( assetInfo . sourceAssetPath ) ) ;
159+ inputFiles . Add ( new BuildDataInputFile ( assetInfo . sourceAssetPath , developmentBuild ) ) ;
163160 }
164161 foreach ( var projectSetting in new NPath ( "ProjectSettings" ) . Files ( "*.asset" ) )
165- inputFiles . Add ( new BuildDataInputFile ( projectSetting ) ) ;
162+ inputFiles . Add ( new BuildDataInputFile ( projectSetting , developmentBuild ) ) ;
166163
167164 var buildData = new BuildData ( )
168165 {
@@ -189,7 +186,7 @@ static public bool CheckDirty(string buildDataPath, BuildOptions buildOptions, s
189186 {
190187 buildData = JsonUtility . FromJson < BuildData > ( buildReportPath . ReadAllText ( ) ) ,
191188 scenes = scenes ,
192- buildOptions = buildOptions & BuildData . BuildOptionsMask
189+ buildOptions = buildOptions
193190 } ;
194191 return tracker . DoCheckDirty ( ) ;
195192 }
0 commit comments