Dynamic Array
When using Physics.NonAlloc, you don't need to think about the array size.
by santutu
Price History +
Background
1. When executing Physics.NonAlloc method, the number of detected colliders and the actual colliders are handled separately as an int and an array[], making it inconvenient to use.
- A DynamicArray instance holding this information would be more convenient to use.
2. Why should we pay attention to trivial matters?
- When using Physics.NonAlloc, determining the size of the array is usually unnecessary.
- If the number of detected colliders exceeds the size of the array, the DynamicArray will automatically resize the array.
Use Case
1. automatic resizing
2. foreach loop
3. for loop
4. passing the detected collider array as a parameter
The detected colliders and their count can be accessed from anywhere using dynamicarray
Readme.md
https://github.com/santutu/unity-dynamic-array/blob/main/README.md
Sample
https://github.com/santutu/unity-dynamic-array/blob/main/Assets/Santutu/Core/DynamicArray/Samples/Sample.cs