Editor_EditorPrefs,EditorUtility學習05

SendSi發表於2017-06-10
public class Editor_PrefabsData : ScriptableWizard {
    [MenuItem("EditTools/PrefabsData",false,18)]
    static void ShowWinWizard()
    {
        ScriptableWizard.DisplayWizard<Editor_PrefabsData>("儲存小資料量的值", "create", "other");
    }

    void CreateWizardOtherButton()
    {
        Debug.LogError("值=");
    }

    void OnWizardUpdate()
    {

    }

    void OnWizardCreate()
    {

    }

    void OnWizardOtherButton()
    {
        Debug.LogError("值="+healthHP);
        EditorPrefs.SetFloat(key_hp, healthHP);


        //顯示進度條
        EditorUtility.DisplayProgressBar("顯示的title資訊,進度條", "進行的資訊", 0);//開始時
        EditorUtility.DisplayProgressBar("顯示的title資訊","進行時",1);//進行時
        EditorUtility.ClearProgressBar();

    }

    void OnEnable()
    {
        healthHP = EditorPrefs.GetFloat(key_hp, healthHP);//EditorPrefs儲存小資料量的值
    }

    public float healthHP = 10;
    const string key_hp = "key_hp";
}

相關文章