|
@@ -3,19 +3,21 @@ using UnityEngine;
|
|
|
|
|
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
|
|
+using static UnityEditor.ShaderGraph.Internal.KeywordDependentCollection;
|
|
|
|
|
+using UnityEngine.Windows;
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
-/// Resourcesディレクトリ以外のオブジェクトにアクセスすることができる。実はResourcesディレクトリのオブジェクトにもアクセスできる
|
|
|
|
|
|
|
+/// Resources Objects other than directories can be accessed. In fact, you can also access objects in the Resources directory.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static class GetAsset
|
|
public static class GetAsset
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
//=================================================================================
|
|
//=================================================================================
|
|
|
- //単体ロード
|
|
|
|
|
|
|
+ //Single load
|
|
|
//=================================================================================
|
|
//=================================================================================
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// ファイルのパス(Assetsから、拡張子も含める)と型を設定し、Objectを読み込む。存在しない場合はNullを返す
|
|
|
|
|
|
|
+ /// Set the file path (including the extension from Assets) and type, and load the Object. Returns Null if not present
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static T Load<T>(string path) where T : Object
|
|
public static T Load<T>(string path) where T : Object
|
|
|
{
|
|
{
|
|
@@ -23,7 +25,7 @@ public static class GetAsset
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// ファイルのパス(Assetsから、拡張子も含める)を設定し、Objectを読み込む。存在しない場合はNullを返す
|
|
|
|
|
|
|
+ /// Set the file path (from Assets, including the extension) and load the Object. Returns Null if not present
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static Object Load(string path)
|
|
public static Object Load(string path)
|
|
|
{
|
|
{
|
|
@@ -31,20 +33,20 @@ public static class GetAsset
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//=================================================================================
|
|
//=================================================================================
|
|
|
- //複数ロード
|
|
|
|
|
|
|
+ //multiple loads
|
|
|
//=================================================================================
|
|
//=================================================================================
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// ディレクトリのパス(Assetsから)と型を設定し、Objectを読み込む。存在しない場合は空のListを返す
|
|
|
|
|
|
|
+ /// Set the directory path(from Assets) and type, and load the Object.Returns an empty List if it does not exist
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static List<T> LoadAll<T>(string directoryPath) where T : Object
|
|
public static List<T> LoadAll<T>(string directoryPath) where T : Object
|
|
|
{
|
|
{
|
|
|
List<T> assetList = new List<T>();
|
|
List<T> assetList = new List<T>();
|
|
|
|
|
|
|
|
- //指定したディレクトリに入っている全ファイルを取得(子ディレクトリも含む)
|
|
|
|
|
|
|
+ //Get all files in the specified directory (including child directories)
|
|
|
string[] filePathArray = Directory.GetFiles(directoryPath, "*", SearchOption.AllDirectories);
|
|
string[] filePathArray = Directory.GetFiles(directoryPath, "*", SearchOption.AllDirectories);
|
|
|
|
|
|
|
|
- //取得したファイルの中からアセットだけリストに追加する
|
|
|
|
|
|
|
+ //Add only assets from the acquired files to the list
|
|
|
foreach (string filePath in filePathArray)
|
|
foreach (string filePath in filePathArray)
|
|
|
{
|
|
{
|
|
|
T asset = Load<T>(filePath);
|
|
T asset = Load<T>(filePath);
|
|
@@ -58,7 +60,7 @@ public static class GetAsset
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
- /// ディレクトリのパス(Assetsから)を設定し、Objectを読み込む。存在しない場合は空のListを返す
|
|
|
|
|
|
|
+ /// Set the directory path (from Assets) and read the Object. Returns an empty List if it does not exist
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
public static List<Object> LoadAll(string directoryPath)
|
|
public static List<Object> LoadAll(string directoryPath)
|
|
|
{
|
|
{
|