Hide
SaintsArray/SaintsList

Unity does not allow to serialize two-dimensional array or list. 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 IReadOnlyList, SaintsList implements IList:

using SaintsField; // SaintsArray GameObject firstGameObject = saintsArrayGo[0]; Debug.Log(saintsArrayGo.value); // the actual array value // SaintsList saintsListGo.Add(new GameObject()); saintsListGo.RemoveAt(0); Debug.Log(saintsListGo.value); // the actual list value

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;