Skip to content

Instantly share code, notes, and snippets.

@yasuakiohama
Created June 14, 2015 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasuakiohama/ebf2c922edcb4ad37fb1 to your computer and use it in GitHub Desktop.
Save yasuakiohama/ebf2c922edcb4ad37fb1 to your computer and use it in GitHub Desktop.
NameCreator/Assets/NameCreator/Editor/MyResources.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class MyResources
{
public static ClassAndPathName[] GetPathToArray()
{
List<ClassAndPathName> path = new List<ClassAndPathName> ();
path.Add (new ClassAndPathName ("Sprite", "Sprites"));
path.Add (new ClassAndPathName ("BGM", "Sounds/BGM"));
path.Add (new ClassAndPathName ("SE", "Sounds/SE"));
return path.ToArray ();
}
public static string[] GetNameToArray(string path)
{
var list = new List<string> ();
Object[] objs = Resources.LoadAll (path);
foreach (Object obj in objs) {
list.Add (obj.name);
}
return list.ToArray ();
}
public class ClassAndPathName
{
public string className {
get;
private set;
}
public string path {
get;
private set;
}
public ClassAndPathName(string className ,string path)
{
this.className = className;
this.path = path;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment