Horje
get random file in directory c# Code Example
get random file in directory c#
using System.IO;
using System.Collections;

var files = Directory.GetFiles("C:/path_example/example", "*.png"); //.png can be changed to match any other desired extentions
string randomFilePath= files[Random.Range(0,files.Length)];
//example output: "C:/path_example/example/pig4.png"




Csharp

Related
c# string to datetime Code Example c# string to datetime Code Example
unity find gameobject by name Code Example unity find gameobject by name Code Example
how to do a web request unity Code Example how to do a web request unity Code Example
c# open file dialog Code Example c# open file dialog Code Example
how to create directory folder in c# Code Example how to create directory folder in c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9