Пример #1
0
        public static string Serialise(this Texture2D _img, EncodeTo _encodeTo = EncodeTo.PNG)
        {
            // Need to append width and height information
            IDictionary _dict = new Dictionary <string, object>();

            _dict["width"]   = _img.width;
            _dict["height"]  = _img.height;
            _dict["texture"] = _img.ToString(_encodeTo);

            // Json format string
            string _strJson = JSONUtility.ToJSON(_dict);

            return(_strJson);
        }
Пример #2
0
        public static string ToJSON(this IDictionary _dictionary)
        {
            string _jsonStr = JSONUtility.ToJSON(_dictionary);

            return(JSONUtility.IsNull(_jsonStr) ? null : _jsonStr);
        }
Пример #3
0
        public static string ToJSON(this IList _list)
        {
            string _jsonStr = JSONUtility.ToJSON(_list);

            return(JSONUtility.IsNull(_jsonStr) ? null : _jsonStr);
        }