study/first_study/Library/PackageCache/com.unity.test-framework.performance@0840f58e4562/Runtime/ResourcesLoader.cs
jh04010421 739d49f1a0 Unity | 2026.01.20
수업 실습 파일
2026-01-20 11:01:57 +09:00

25 lines
674 B
C#

using System;
using UnityEngine;
namespace Unity.PerformanceTesting
{
internal static class ResourcesLoader
{
public static T Load<T>(string assetPath, string prefsKey) where T : class
{
try
{
var runResource = Resources.Load<TextAsset>(assetPath.Replace(".json", ""));
var json = Application.isEditor ? PlayerPrefs.GetString(prefsKey) : runResource.text;
var run = JsonUtility.FromJson<T>(json);
return run;
}
catch (Exception e)
{
Debug.LogError(e);
}
return null;
}
}
}