public static void SetDateTime(string key, DateTime value) { if (value.Kind == DateTimeKind.Local) { value = value.ToUniversalTime(); } UserPrefs.SetLong(key, value.ToBinary()); }
public static long?SetLongAndReturnPrevious(string key, long value) { long?result = null; if (UserPrefs.HasKey(key)) { string @string = PlayerPrefs.GetString(key); try { result = new long?(long.Parse(@string, NumberStyles.Integer, NumberFormatInfo.InvariantInfo)); } catch (FormatException) { } catch (OverflowException) { } } UserPrefs.SetLong(key, value); return(result); }