You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
650 B
C#
24 lines
650 B
C#
3 weeks ago
|
//Shady
|
||
|
using UnityEngine;
|
||
|
|
||
|
public sealed class PlayerData
|
||
|
{
|
||
|
public Gender gender = Gender.Male;
|
||
|
public Vector3 position = Vector3.zero;
|
||
|
public Quaternion rotation = Quaternion.identity;
|
||
|
|
||
|
public byte[] Serialize() => System.Text.Encoding.UTF8.GetBytes(JsonUtility.ToJson(this));
|
||
|
|
||
|
public static PlayerData Deserialize(byte[] data, int index, int count)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
return JsonUtility.FromJson<PlayerData>(System.Text.Encoding.UTF8.GetString(data, index, count));
|
||
|
}//try end
|
||
|
catch
|
||
|
{
|
||
|
return null;
|
||
|
}//catch end
|
||
|
}//Deserialize() end
|
||
|
|
||
|
}//class end
|