Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sandrofigo/enumerable-extensions-unity3d
Extension class for easily working with collections and random elements
https://github.com/sandrofigo/enumerable-extensions-unity3d
extension extension-functions openupm unity unity-scripts unity2d unity3d unity3d-plugin utility utility-classes utility-library
Last synced: 6 days ago
JSON representation
Extension class for easily working with collections and random elements
- Host: GitHub
- URL: https://github.com/sandrofigo/enumerable-extensions-unity3d
- Owner: sandrofigo
- License: unlicense
- Created: 2022-07-31T11:48:23.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-28T13:05:21.000Z (over 2 years ago)
- Last Synced: 2025-02-13T22:17:01.348Z (6 days ago)
- Topics: extension, extension-functions, openupm, unity, unity-scripts, unity2d, unity3d, unity3d-plugin, utility, utility-classes, utility-library
- Language: C#
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Enumerable Extensions
Extension class for easily working with collections and random elements[](https://openupm.com/packages/com.sandrofigo.enumerable-extensions-unity3d/)
## Installation
There are multiple ways to install this package into your project:
- Add it to your project through [OpenUPM](https://openupm.com/packages/com.sandrofigo.enumerable-extensions-unity3d/) (recommended)
- Add the package to the Unity package manager using the HTTPS URL of this repository (recommended)
- Download the whole repository as a .zip and place the contents into a subfolder in your assets folder
- Fork the repository and add it as a submodule in git## Usage
```csharp
using EnumerableExtensions;
using UnityEngine;public class Foo : MonoBehaviour
{
public void Bar()
{
var list = new List();
list.Add(1);
list.Add(2);
list.Add(3);
Debug.Log(list.Random());
// Output: either 1, 2 or 3
foreach(int i in list.RandomOnce())
Debug.Log(i);
// Output: 1, 2 and 3 in random order
Debug.Log(list.IsEmpty());
// Output: false
}
}
```## Collaboration
Support this project with a ⭐️, report an issue or if you feel adventurous and would like to extend the functionality open a pull request.