Keep a list of InputControl without allocating
managed memory.
Inherited Members
System.ValueType.Equals(System.Object)
System.ValueType.GetHashCode()
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
public struct InputControlList<TControl> : IList<TControl>, IReadOnlyList<TControl>, IDisposable where TControl : InputControl
Type Parameters
Name |
Description |
TControl |
|
Constructors
Declaration
public InputControlList(params TControl[] values)
Parameters
Type |
Name |
Description |
TControl[] |
values |
|
Construct a list that allocates unmanaged memory from the given allocator.
Declaration
public InputControlList(Allocator allocator, int initialCapacity = 0)
Parameters
Type |
Name |
Description |
Allocator |
allocator |
|
System.Int32 |
initialCapacity |
|
// Create a control list that allocates from the temporary memory allocator.
using (var list = new InputControlList(Allocator.Temp))
{
// Add all gamepads to the list.
InputSystem.FindControls("<Gamepad>", list);
}
Declaration
public InputControlList(IEnumerable<TControl> values, Allocator allocator = null)
Parameters
Type |
Name |
Description |
IEnumerable<TControl> |
values |
|
Allocator |
allocator |
|
Properties
Number of controls that can be added before more (unmanaged) memory has to be allocated.
Declaration
public int Capacity { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Number of controls in the list.
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Declaration
public bool IsReadOnly { get; }
Property Value
Type |
Description |
System.Boolean |
|
Return the control at the given index.
Declaration
public TControl this[int index] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
index |
Index of control.
|
Property Value
Type |
Description |
TControl |
|
Methods
Declaration
public void Add(TControl control)
Parameters
Type |
Name |
Description |
TControl |
control |
|
Declaration
public void AddRange(IEnumerable<TControl> list, int count = -1, int destinationIndex = -1)
Parameters
Type |
Name |
Description |
IEnumerable<TControl> |
list |
|
System.Int32 |
count |
|
System.Int32 |
destinationIndex |
|
Add a slice of elements taken from the given list.
Declaration
public void AddSlice<TList>(TList list, int count = -1, int destinationIndex = -1, int sourceIndex = 0)where TList : IReadOnlyList<TControl>
Parameters
Type |
Name |
Description |
TList |
list |
|
System.Int32 |
count |
|
System.Int32 |
destinationIndex |
|
System.Int32 |
sourceIndex |
|
Type Parameters
Declaration
Declaration
public bool Contains(TControl control)
Parameters
Type |
Name |
Description |
TControl |
control |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
public void CopyTo(TControl[] array, int arrayIndex)
Parameters
Type |
Name |
Description |
TControl[] |
array |
|
System.Int32 |
arrayIndex |
|
Declaration
Declaration
public IEnumerator<TControl> GetEnumerator()
Returns
Type |
Description |
IEnumerator<TControl> |
|
Declaration
public int IndexOf(TControl control)
Parameters
Type |
Name |
Description |
TControl |
control |
|
Returns
Type |
Description |
System.Int32 |
|
Declaration
public void Insert(int index, TControl item)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
TControl |
item |
|
Declaration
public bool Remove(TControl control)
Parameters
Type |
Name |
Description |
TControl |
control |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
public void RemoveAt(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
Declaration
public void Sort<TCompare>(int startIndex, int count, TCompare comparer)where TCompare : IComparer<TControl>
Parameters
Type |
Name |
Description |
System.Int32 |
startIndex |
|
System.Int32 |
count |
|
TCompare |
comparer |
|
Type Parameters
Name |
Description |
TCompare |
|
Declaration
public void SwapElements(int index1, int index2)
Parameters
Type |
Name |
Description |
System.Int32 |
index1 |
|
System.Int32 |
index2 |
|
Declaration
public TControl[] ToArray()
Returns
Type |
Description |
TControl[] |
|
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Overrides
System.ValueType.ToString()