I’m getting intermittent errors on our build machine due to serialization issues. It’s strange that it only seems to happen on Android builds on our Windows build machine (not iOS builds on our macOS build machine). It occurs when we build AssetBundles to save into StreamingAssets folder of the binary. The error looks like this:
Type ‘[Assembly-CSharp]DungeonCrawler.Client.PVPHubPopup’ has an extra field ‘rewardProgressLabel’ of type ‘TMPro.TextMeshProUGUI’ in the player and thus can’t be serialized (expected ‘attackLogTabButton’ of type ‘UnityEngine.UI.Button’)
Fields serialized in Editor, class ‘DungeonCrawler.Client.PVPHubPopup’
‘playerNameLabel’ of type ‘TMPro.TextMeshProUGUI’
‘playerLevelLabel’ of type ‘TMPro.TextMeshProUGUI’
‘playerRankingLabel’ of type ‘TMPro.TextMeshProUGUI’
‘attackLogTabButton’ of type ‘UnityEngine.UI.Button’
‘defenseLogTabButton’ of type ‘UnityEngine.UI.Button’
‘battleLogContainer’ of type ‘UnityEngine.Transform’
‘battleLogEntryPrefab’ of type ‘UnityEngine.GameObject’
Fields serialized in target platform, class ‘DungeonCrawler.Client.PVPHubPopup’
‘playerNameLabel’ of type ‘TMPro.TextMeshProUGUI’
‘playerLevelLabel’ of type ‘TMPro.TextMeshProUGUI’
‘playerRankingLabel’ of type ‘TMPro.TextMeshProUGUI’
‘rewardProgressLabel’ of type ‘TMPro.TextMeshProUGUI’
‘attackLogTabButton’ of type ‘UnityEngine.UI.Button’
‘defenseLogTabButton’ of type ‘UnityEngine.UI.Button’
‘battleLogContainer’ of type ‘UnityEngine.Transform’
‘battleLogEntryPrefab’ of type ‘UnityEngine.GameObject’
I’ve searched the forums and beyond (Stack Overflow, etc.) for answers but none of them seem to apply to us. Specifically:
- We do not use partial classes;
- We do not have serialized fields inside preprocessor directives;
- We set the “-buildTarget android” flag on each invocation of the build
The files complained about are also different – it’s not always the same file. I’ve tried removing the Library folder on the build machine to no avail. Is there something weird with the way
BuildPipeline.BuildAssetBundles() works? We’re just passing in the StreamingAssets directory, ChunkBasedCompression as an option, and BuildTarget.Android as the target.
Re-running the build after the failure will put the build back into the correct state, but I’m not sure what system is getting put into an incorrect state in the first place.
Any ideas? I’d like to file a bug but it’s tough to reproduce because it relies not only on our project but also our Jenkins build machine and its job configuration.