Giter Site home page Giter Site logo

tarray's Introduction

⏺️ TArray - Ultimate Serializable Array [C# / Unity]

TArray Logo

TArray is incredibly fast, universal and serializable array solution for C# and Unity.

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.

📘 Installation

You can install it by:

  1. Using Unity Git packages support:
Toolabar -> Window/Package Manager ->  -> Add package from Git URL -> "https://github.com/ovsky/TArray.git#upm"
  1. Unity Git URL suppport, by adding this entry in your packages manifest.json:
"com.ovsky.tarray": "https://github.com/ovsky/TArray.git#upm"
  1. 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.

📖 QuickStart

Code:

So, let's see the most important TArray features:

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!

🗂️ Editor

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!

Integer Preview:

TArray Integer Preview

GameObject Preview:

TArray GameObject Preview

Boolean Preview:

TArray Boolean Preview

📝 License:

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/

tarray's People

Contributors

ovsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tblack-studio

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.