// Start is called before the first frame update void Start() { var la = new ListAccessor <int>(5); la.Reserve(10); la[9] = 2; Debug.Assert(la[0] == default(int)); Debug.Assert(la[8] == default(int)); Debug.Assert(la[9] == 2); Debug.Log(la[10]);// 产生异常 }
/// <summary> /// Устанавливает получатель списка элементов заданного типа. /// </summary> /// <param name="accessor">The accessor.</param> /// <returns>Группу настроек фильтрации данных</returns> public T SetListAccessor(ListAccessor accessor) { this.accessor = accessor; return(this as T); }
public ArrayView(List <T> list) { this.array = ListAccessor <T> .GetArray(list); this.size = list.Count; }
/// <summary> /// Initializes a new instance of the <see cref="ListQSFilterSetting<T, TElement>"/> class. /// </summary> public ListQSFilterSetting() { accessor = null; List = new List <TElement>(); }
public void SetTriangles(int[] triangles, int count) { ListAccessor <int> .SetArray(s_ScratchInt, triangles, count); mesh.SetTriangles(s_ScratchInt, 0); }
public static T[] GetInternalArray <T>(List <T> list) { //returns the internal backing array return(ListAccessor <T> .accessor(list)); }
public void SetTextureCoord3(Vector4[] texCoords, int count) { ListAccessor <Vector4> .SetArray(s_ScratchVector4, texCoords, count); mesh.SetUVs(3, s_ScratchVector4); }
public void SetNormals(Vector3[] normals, int count) { ListAccessor <Vector3> .SetArray(s_ScratchVector3, normals, count); mesh.SetNormals(s_ScratchVector3); }
public void SetColors(Color[] colors, int count) { ListAccessor <Color> .SetArray(s_ScratchColor, colors, count); mesh.SetColors(s_ScratchColor); }
public void SetVertices(Vector3[] positions, int count) { ListAccessor <Vector3> .SetArray(s_ScratchVector3, positions, count); mesh.SetVertices(s_ScratchVector3); }
public static T[] GetListArray <T>(this List <T> list) { return(ListAccessor <T> .Getter(list)); }