Search Issue Tracker

By Design

Votes

0

Found in

2019.4

2020.3

2020.3.23f1

2021.2

2022.1

2022.2

Issue ID

1385621

Regression

No

PlayerSettings.Android.targetArchitectures == AndroidArchitecture.All returns false when all architectures are selected

Android

-

How to reproduce:
1. Open the attached "1385621_Repro.zip" project
2. Open the Player Settings (Edit->Project Settings...->Player)
3. In the Other Settings make sure that Scripting Backend is set to "IL2CPP" and all of the Target Architectures are enabled
4. Open the Scene "SampleScene"
5. Enter the Play Mode

Expected results: "True" is printed in the Console
Actual results: "False" is printed in the Console

Reproducible with: 2019.4.36f1, 2020.3.26f1, 2021.2.8f1, 2022.1.0b4, 2022.2.0a2

Note:
- If all Target Architectures are enabled "PlayerSettings.Android.targetArchitectures" will return the list of them while "AndroidArchitecture.All" returns "All' instead of the list

  1. Response avatar

    Resolution Note:

    The PlayerSettings.Android.targetArchitectures returns an integer which has relevant bits set indicating selected architectures, while AndroidArchitecture.All is an integer with all bits set, it's inteded for enabling all architectures, not checking them, the simple "==" comparison will be false, since there are only 4 actual architectures, so only 4 bits are actually used.
    The proper way to check if all architectures have been enabled is to get all possible enum values except for None and All and check if all are acounted for. You can get all enum values by calling this:
    https://docs.microsoft.com/en-us/dotnet/api/system.enum.getvalues?view=net-6.0

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.