Created
September 30, 2012 15:39
-
-
Save anchan828/3807207 to your computer and use it in GitHub Desktop.
WindowsでEditorPrefsを使うときにはBase64で保存する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using System.Text; | |
public class NewBehaviourScript{ | |
[MenuItem("Window/Save")] | |
static void Save (){ | |
EditorPrefs.SetString ("Hoge", ToBase64 ("日本語")); | |
} | |
[MenuItem("Window/Load")] | |
static void Load (){ | |
Debug.Log (FromBase64 (EditorPrefs.GetString ("Hoge"))); | |
} | |
static string ToBase64 (string s){ | |
return System.Convert.ToBase64String (UTF8Encoding.UTF8.GetBytes (s)); | |
} | |
static string FromBase64 (string s){ | |
return UTF8Encoding.UTF8.GetString (System.Convert.FromBase64String (s)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment