Created
June 14, 2015 00:12
-
-
Save yasuakiohama/ebf2c922edcb4ad37fb1 to your computer and use it in GitHub Desktop.
NameCreator/Assets/NameCreator/Editor/MyResources.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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