Search Issue Tracker
By Design
Votes
0
Found in
2020.2
2020.2.0b7
2021.1
Issue ID
1286500
Regression
No
[Android] Build fails with an error when using a Custom Editor Window to Build the Player
How to reproduce:
1. Open the attached "AndroidPermissions-TestProject.zip" Project
2. Press Build > Build for iOS in Unity Top Menu
3. Observe errors in the console
Expected Behavior: The Android player builds as expected
Actual Behavior: Errors are thrown and the build fails
Reproducible with: 2020.2.0f1, 2021.1.0a9
Could not test on:
- 2018.4 - the menu item does not appear.
- 2019.4 and 2020.1 - got an error "'Permission' does not contain a definition for 'RequestUserPermissions'"
Note:
- Error:
"Type '[Assembly-CSharp]permissionTestScript' has an extra field 'tMarker' of type 'UnityEngine.Transform' in the player and thus can't be serialized
UnityEditor.BuildPipeline:BuildPlayer (UnityEditor.BuildPlayerOptions)
BuildPlayerExample:MyBuild () (at Assets/Editor/building.cs:18)"
- This does not seem to reproduce on iOS
- It seems that this case might be specific to this project as it does not reproduce on every project
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note (2021.1.X):
The build fails because active build target in editor is iOS and some scripts have code behind UNITY_ANDROID define and that code affect serialization. When building player, it is required for active build target to be the same as the target you are building for.
You can switch build target programatically:
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
Additional note: you have to remove destination directory (iOSBuild), otherwise the build will still fail in the very end.