An auxiliary struct to iterate over the joints on a PhysicsJoints2D component. Use PhysicsJoints2D.GetIterator to acquire an iterator for the component's joint buffer. More...
Inherits IEnumerator< Joint >.
Public Member Functions | |
JointsIterator | GetEnumerator () |
The iterator is also an enumerator. This method is useful for accessing the elements in a foreach loop, for instance. More... | |
bool | MoveNext () |
Moves to the next joint. More... | |
void | Reset () |
Resets the iterator to its original state. More... | |
Properties | |
Joint | Current [get] |
A copy of the current joint being iterated. To modify the actual element in the buffer, use CurrentUnsafe instead. More... | |
int | CurrentIndex [get] |
The index on the buffer of the element currently being iterated. The index is out of the valid range if the iterator has just been created on Reset. More... | |
Joint * | CurrentUnsafe [get] |
A pointer to the current joint being iterated. This allows modifications to the element in the actual buffer of joints. More... | |
An auxiliary struct to iterate over the joints on a PhysicsJoints2D component. Use PhysicsJoints2D.GetIterator to acquire an iterator for the component's joint buffer.
If new elements are added while iterating and this causes the buffer to be expanded, the iterator will keep iterating over the previous buffer, which is not immediately disposed (see AddJoint). In this case, further changes to elements in the buffer being iterated will not modify the elements on the new buffer. Hence, the addition of elements while iterating is not recommended, unless the access to the elements are read-only.
|
inline |
The iterator is also an enumerator. This method is useful for accessing the elements in a foreach loop, for instance.
|
inline |
Moves to the next joint.
|
inline |
Resets the iterator to its original state.
|
get |
A pointer to the current joint being iterated. This allows modifications to the element in the actual buffer of joints.
NullReferenceException | If the iterator buffer is null. |
ArgumentOutOfRangeException | If the iterator current index is outside the valid range of the buffer: [0, count). |
|
get |
A copy of the current joint being iterated. To modify the actual element in the buffer, use CurrentUnsafe instead.
|
get |
The index on the buffer of the element currently being iterated. The index is out of the valid range if the iterator has just been created on Reset.