コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Color、Vector2、Vector3、Rect などを EditorPrefs に保存できる「EditorPrefsPlus」紹介(無料)

f:id:baba_s:20171021151751p:plain

概要

2013/8/16 に「EditorPrefsPlus」がリリースされました

「EditorPrefsPlus」を導入すると、
Color、Vector2、Vector3、Rect などを EditorPrefs に保存できるようになります

検証環境

  • Unity 2017.1.1f1
  • EditorPrefsPlus 1.0.2

使い方

// 読み込み
testBool    = EditorPrefsPlus.GetBool("TestBool");
testColour  = EditorPrefsPlus.GetColour("TestColour");
testV2      = EditorPrefsPlus.GetVector2("TestVector2");
testV3      = EditorPrefsPlus.GetVector3("TestVector3");
testV4      = EditorPrefsPlus.GetVector4("TestVector4");
testQuat    = EditorPrefsPlus.GetQuaternion("TestQuat");
testRect    = EditorPrefsPlus.GetRect("TestRect");

// 保存
EditorPrefsPlus.SetBool("TestBool", testBool);
EditorPrefsPlus.SetColour("TestColour", testColour);
EditorPrefsPlus.SetVector2("TestVector2", testV2);
EditorPrefsPlus.SetVector3("TestVector3", testV3);
EditorPrefsPlus.SetVector4("TestVector4", testV4);
EditorPrefsPlus.SetQuaternion("TestQuat", testQuat);
EditorPrefsPlus.SetRect("TestRect", testRect);

関連記事