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
- [Tile Palette] Sprites not rendering when brush tool "Paint a filled box with active brush" is used for the first time
- Adding available Nodes with longer names in Fragment Context window overflow Fragment Context window in Shader Graph
- "Layer Palette Profile" Asset is automatically applied to the second Terrain but doesn't load any layers
- "Terrain Tools" shortcut conflicts with the Overlays shortcut by default
- Longer Shader Graph Property Reference names breaks VFX Graph Output Particle Node
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.