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
- [VFX Graph] ArcTorus Transform changes in blackboard not reflected in Graph
- Text deletion works incorrectly in an input field when the Chinese language is used and the "Event System" Component is turned off
- Typed text doesn't appear in an input field when the Chinese language is used and the "Event System" Component is turned off
- Script associated with "GlobalVolumeFeature" is missing when inspecting "Mobile Renderer" Asset
- Clearable "RenderingCommandBuffer" errors are thrown in the Console when creating project using Universal 3D Template
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.