A game about forced loneliness, made by TACStudios
1using System;
2using UnityEngine;
3
4namespace Unity.PerformanceTesting
5{
6 internal static class ResourcesLoader
7 {
8 public static T Load<T>(string assetPath, string prefsKey) where T : class
9 {
10 try
11 {
12 var runResource = Resources.Load<TextAsset>(assetPath.Replace(".json", ""));
13 var json = Application.isEditor ? PlayerPrefs.GetString(prefsKey) : runResource.text;
14 var run = JsonUtility.FromJson<T>(json);
15 return run;
16 }
17 catch (Exception e)
18 {
19 Debug.LogError(e);
20 }
21
22 return null;
23 }
24 }
25}