Search Issue Tracker
Won't Fix
Votes
0
Found in [Package]
2.6.0-exp.2 - Collections
Issue ID
ECSB-1668
Regression
No
UnsafeBitArray.Find() method returns the wrong index and goes beyond the given scope to find the index
How to reproduce:
1. Open the “BitsTest.zip“ project
2. Open the “SampleScene“
3. Enter Play Mode
4. Observe the Console
Expected result: “Assertion failed” error is not thrown
Actual result: “Assertion failed” error is thrown
Reproducible in: 1.1.0, 2.6.0-exp.2 (2022.3.62f1, 6000.0.48f1, 6000.1.2f1, 6000.2.0a10)
Reproduced on: Windows 11 Pro (24H2)
Not reproduced on: No other environment tested
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 grid is moved after entering Play Mode
- Tile Palette Edit mode turns off in Play Mode
- The Editor crashes when Generating Font Atlas in the Font Asset Creator with “9999999999” padding and 256x256 Atlas Resolution
- [iOS] An “ArgumentNullException” error is thrown when GetIntroductoryPriceDictionary() method is called
- Font Import Settings documentation page is missing when the documentation button is pressed in the Inspector window
Resolution Note:
This is actually not a bug. When searching, algorithm prefers finding 0 bits fast, not optimal set of bits. Because user is creating 100 bits array, find has extra storage to give fastest results. Search will narrow down to smaller gaps which are more expensive to search for once there are no 0-bits in faster to find range.
For example if you limit search to first 16 bits, instead full range of bit array, you would get desired results:
Instead:
Debug.Assert(bits.Find(0, 5) == 4); // checks 5 bits starting from index 0 - should return 4, and therefore not fail the assertion
Try:
Debug.Assert(bits.Find(0, 16, 5) == 4); // checks 5 bits starting from index 0 - should return 4, and therefore not fail the assertion