Struct WeightedTransformArray
This struct defines a List of WeightedTransform. WeightedTransformArray can be animated (as opposed to System.List and C# arrays) and is implemented with a hard limit of eight WeightedTransform elements. See also WeightedTransform and WeightRangeAttribute.
Namespace: UnityEngine.Animations.Rigging
Syntax
[Serializable]
public struct WeightedTransformArray : IList<WeightedTransform>, ICollection<WeightedTransform>, IEnumerable<WeightedTransform>, IList, ICollection, IEnumerable
Constructors
WeightedTransformArray(Int32)
Constructor.
Declaration
public WeightedTransformArray(int size)
Parameters
Type | Name | Description |
---|---|---|
Int32 | size | Size of the array. This will clamped to be a number in between 0 and k_MaxLength. |
See Also
Fields
k_MaxLength
Maximum number of elements in WeightedTransformArray.
Declaration
public static readonly int k_MaxLength
Field Value
Type | Description |
---|---|
Int32 |
Properties
Count
The number of elements contained in the WeightedTransformArray.
Declaration
public readonly int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
IsFixedSize
Retrieves whether WeightedTransformArray has a fixed size. Always false.
Declaration
public readonly bool IsFixedSize { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsReadOnly
Retrieves whether WeightedTransformArray is read-only. Always false.
Declaration
public readonly bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
Boolean |
Item[Int32]
Gets or sets the WeightedTransform at the specified index.
Declaration
public WeightedTransform this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the WeightedTransform to get or set. |
Property Value
Type | Description |
---|---|
WeightedTransform |
Methods
Add(WeightedTransform)
Adds an item to the WeightedTransformArray.
Declaration
public void Add(WeightedTransform value)
Parameters
Type | Name | Description |
---|---|---|
WeightedTransform | value | The WeightedTransform to add to the WeightedTransformArray. |
Clear()
Removes all items from the WeightedTransformArray.
Declaration
public void Clear()
Contains(WeightedTransform)
Determines whether the WeightedTransformArray contains a specific value.
Declaration
public bool Contains(WeightedTransform value)
Parameters
Type | Name | Description |
---|---|---|
WeightedTransform | value | The WeightedTransform to locate in the WeightedTransformArray. |
Returns
Type | Description |
---|---|
Boolean | true if the Object is found in the WeightedTransformArray; otherwise, false. |
CopyTo(WeightedTransform[], Int32)
Copies the elements of the WeightedTransform to an Array, starting at a particular Array index.
Declaration
public void CopyTo(WeightedTransform[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
WeightedTransform[] | array | The one-dimensional Array that is the destination of the elements copied from WeightedTransform. The Array must have zero-based indexing. |
Int32 | arrayIndex | The zero-based index in array at which copying begins. |
GetEnumerator()
Returns an enumerator that iterates through a collection.
Declaration
public IEnumerator<WeightedTransform> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<WeightedTransform> | An IEnumerator object that can be used to iterate through the collection. |
GetTransform(Int32)
Retrieves a Transform reference on a WeightedTransform at specified index.
Declaration
public Transform GetTransform(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index value. |
Returns
Type | Description |
---|---|
Transform | The Transform reference at specified index. |
GetWeight(Int32)
Retrieves a weight on a WeightedTransform at specified index.
Declaration
public float GetWeight(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index value. |
Returns
Type | Description |
---|---|
Single | The weight value at specified index. |
IndexOf(WeightedTransform)
Determines the index of a specific item in the WeightedTransformArray.
Declaration
public int IndexOf(WeightedTransform value)
Parameters
Type | Name | Description |
---|---|---|
WeightedTransform | value | The WeightedTransform to locate in the WeightedTransformArray. |
Returns
Type | Description |
---|---|
Int32 | The index of value if found in the list; otherwise, -1. |
Insert(Int32, WeightedTransform)
Inserts an item to the WeightedTransformArray at the specified index.
Declaration
public void Insert(int index, WeightedTransform value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index at which value should be inserted. |
WeightedTransform | value | The WeightedTransform to insert into the WeightedTransformArray. |
OnValidate(ref WeightedTransformArray, Single, Single)
Method to call from a provider's OnValidate() callback to ensure all weight values are within the valid range. See also WeightRangeAttribute.
Declaration
public static void OnValidate(ref WeightedTransformArray array, float min = 0F, float max = 1F)
Parameters
Type | Name | Description |
---|---|---|
WeightedTransformArray | array | WeightedTransformArray to adjust. |
Single | min | Minimum value to clamp array values with. |
Single | max | Maximum value to clamp array values with. |
Remove(WeightedTransform)
Removes the first occurrence of a specific WeightedTransform from the WeightedTransformArray.
Declaration
public bool Remove(WeightedTransform value)
Parameters
Type | Name | Description |
---|---|---|
WeightedTransform | value | The WeightedTransform to remove from the WeightedTransformArray. |
Returns
Type | Description |
---|---|
Boolean | True if value was removed from the array, false otherwise. |
RemoveAt(Int32)
Removes the WeightedTransformArray item at the specified index.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index of the item to remove. |
SetTransform(Int32, Transform)
Sets the Transform reference on a WeightedTransform at specified index.
Declaration
public void SetTransform(int index, Transform transform)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index value. |
Transform | transform | The Transform reference to set. |
SetWeight(Int32, Single)
Sets a weight on a WeightedTransform at specified index.
Declaration
public void SetWeight(int index, float weight)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | Index value. |
Single | weight | The weight value to set. |