8000 GitHub - koyashiro/udon-list: List implementation for UdonSharp.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 14, 2023. It is now read-only.

koyashiro/udon-list

Repository files navigation

⚠️ ARCHIVED ⚠️

This repository has been archived following the launch of DataList. We strongly recommend using DataList for future projects.

If you're in need of a generic version of DataList, consider using the GenericDataContainer repository as a potential resource.

UdonList

List implementation for UdonSharp.

Installation

To use this package, you need to add my package repository. Please read more details here.

Please install this package with Creator Companion or VPM CLI.

Creator Companion

  1. Enable the koyashiro package repository.

    image

  2. Find UdonList from the list of packages and install any version you want.

VPM CLI

  1. Execute the following command to install the package.

    vpm add package net.koyashiro.udonlist

Example

UdonList example for a string.

In addition, UdonList<int>, UdonList<float>, UdonList<bool>, UdonList<UdonSharpBehaviour>, UdonList<object>, and so on can be used.

using UnityEngine;
using UdonSharp;
using Koyashiro.UdonList;

public class UdonListSample : UdonSharpBehaviour
{
    private void Start()
    {
        var list = UdonList<string>.New(); // Same as C# `new List<string>();`
        list.Add("first");     // ["first"]
        list.Add("second");    // ["first", "second"]
        list.Add("third");     // ["first", "second", "third"]
        list.Remove("second"); // ["first", "third"]

        // List to array
        var convertedArray = list.ToArray();

        // Array to list
        var convertedList = UdonList<string>.New(convertedArray);

        // Alternative foreach
        for (var i = 0; i < convertedList.Count(); i++)
        {
            Debug.Log(list.GetValue(i)); // "first", "third"
        }
    }
}

About

List implementation for UdonSharp.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages

0