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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.