23 lines
490 B
C#
23 lines
490 B
C#
|
using System;
|
||
|
using UnityEngine;
|
||
|
|
||
|
// ReSharper disable once CheckNamespace
|
||
|
namespace BlueWaterProject
|
||
|
{
|
||
|
public static class JsonHelper
|
||
|
{
|
||
|
public static T[] FromJson<T>(string json)
|
||
|
{
|
||
|
var newJson = "{ \"array\": " + json + "}";
|
||
|
var wrapper = JsonUtility.FromJson<Wrapper<T>>(newJson);
|
||
|
return wrapper.array;
|
||
|
}
|
||
|
|
||
|
[Serializable]
|
||
|
private class Wrapper<T>
|
||
|
{
|
||
|
public T[] array;
|
||
|
}
|
||
|
}
|
||
|
}
|