Using ShuffleArray() to Randomize an Array
How It Works:
When the object is interacted with, it shuffles the
numbersarray.The shuffled array is logged to the console.
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class ShuffleArrayExample : UdonSharpBehaviour
{
public int[] numbers = { 1, 2, 3, 4, 5 };
public override void Interact()
{
Utilities.ShuffleArray(numbers);
Debug.Log("Shuffled Array: " + string.Join(", ", numbers));
}
}
Last updated