unity3d get all names of resources code example

Example: unity3d get all names of resources

using System.IO; using System.Collections.Generic; private List PlayersInFolder; void Start () {      PlayersInFolder = new List ();      string myPath = "Assets/Resources/";      DirectoryInfo dir = new DirectoryInfo (myPath);      FileInfo[] info = dir.GetFiles ("*.*");      foreach (FileInfo f in info) {     if (f.Extension == ".FBX" || f.Extension ==      ".prefab") {     string tempName = f.Name;     string extension = f.Extension;     string strippedName = tempName.Replace (extension,  "");                                                                 PlayersInFolder.Add (strippedName);      } }

Tags:

Misc Example