The main adventage of TArray in comparison to others is that this solution combines unbelievably simple and low amout of code [totally 180 lines] with nearly every expected feature, beacuse of fullness of well-written approaches.
Another is that the TArray is not a class like many other extended arrays, but still a structure like classic array - so it is really fast and memory safe and friendly, and also support enumerations and LINQ expressions natively.
- Using Unity Git packages support:
Toolabar -> Window/Package Manager -> + -> Add package from Git URL -> "https://github.com/ovsky/TArray.git#upm"
- Unity Git URL suppport, by adding this entry in your packages manifest.json:
"com.ovsky.tarray": "https://github.com/ovsky/TArray.git#upm"
- Using Unity tarball support and wget [Linux] or start [Windows] download:
Linux: "wget https://github.com/ovsky/TArray/tarball/upm -O ovsky.tarray-upm.tgz"
Windows: "start https://github.com/ovsky/TArray/tarball/upm"
Use: Toolabar -> Window/Package Manager -> + -> Add package from tarball -> Select: "ovsky.tarray-*.tgz"
The upm stands for Unity Package Manager - the default manager for Unity-ready external packages/extensions.
Multiple declaration possibilities:
TArray<int> integerArray = new TArray<int>(5, 5); // Classic declaration
TArray<int> integerArray = new int[5, 5]; // Array attributed declaration
TArray<int> integerArray = new Array[5, 5]; // Classic array declaration
TArray<int> integerArray = new (5, 5); // Modern .NET declaration
Easy conversion support:
TArray<int> integerArray = stringArray.Cast<int>(); // Convert string to int array
TArray<string> stringArray = customArray.Cast<string>(); // Convert custom to string array
Different value get
/set
options:
int element = integerArray[2, 2]; // Get value using attributes
int element = integerArray.Get(2,2); // Get value using method
integerArray[2, 2] = 1; // Set value using attributes
integerArray.Set(2,2, 1); // Set value using method
All LINQ operations support:
TArray<Pets> petsArray = petsArray.Array.OrderBy(pet => pet.Age).ToArray(); // Sort class array by class property value
TArray<Pets> dogsArray = petsArray.Array.Select(pet => pet is Dog).ToArray(); // Select Dogs from Pets array
TArray<int> integerArray = integerArray.Array.OrderBy(i => i).ToArray(); // Sort int array values
Type-free array operations:
ITArray valueArray;
valueArray = new TArray<int>(5, 5); // Declare int array at the field
valueArray = valueArray.Cast<string>(); // Cast the array to string values and apply to undefined field
valueArray = new TArray<bool>(5, 5).Set(0,0, true); // Then change it to bool array with (0, 0) set to true
TArray<bool> boolArray = valueArray; // Apply the undefined value array to array with defined type
And more!
TArray Editor (Property Drawer actually) - is an extendable, flexible, and the most important: it supports all serializable types (existing and user-defined) out of the box, without creating the new Unity Inspector or Editor!
Copyright (C) 2023 - Przemysław Orłowski
"THE SOFTWARE IS PROVIDED 'AS IT IS' (...)"
also known as:
**The MIT License**:
https://choosealicense.com/licenses/mit/