Hide
SaintsArray/SaintsList

Unity does not serialize nested arrays or lists. SaintsArray and SaintsList are there to help.

The target can also be interface / abstract type.

using SaintsField; // two dimensional array public SaintsArray<GameObject>[] gameObjects2; public SaintsArray<SaintsArray<GameObject>> gameObjects2Nest; // four dimensional array, if you like. public SaintsArray<SaintsArray<SaintsArray<GameObject>>>[] gameObjects4;

image

SaintsArray implements IList with the fixed-size behavior of an array. SaintsList implements IList and mirrors the common List APIs:

using SaintsField; // SaintsArray GameObject firstGameObject = saintsArrayGo[0]; saintsArrayGo[0] = anotherGameObject; // SaintsList saintsListGo.Add(new GameObject()); saintsListGo.RemoveAt(0); saintsListGo.Sort((a, b) => string.CompareOrdinal(a.name, b.name));

These two can be easily converted to array/list:

using SaintsField; // SaintsArray to Array GameObject[] arrayGo = saintsArrayGo; // Array to SaintsArray SaintsArray<GameObject> expSaintsArrayGo = (SaintsArray<GameObject>)arrayGo; // SaintsList to List List<GameObject> ListGo = saintsListGo; // List to SaintsList SaintsList<GameObject> expSaintsListGo = (SaintsList<GameObject>)ListGo;

SaintsArray Attribute

This allows you to set search and paging.

  • bool searchable = true: make it searchable
  • int numberOfItemsPerPage = 0: items per page
[SaintsArray(numberOfItemsPerPage: 5)] public SaintsArray<int[]> pagging;

Reference Type

Example of using interface

public SaintsArray<IInterface1[]> inters;