コード例 #1
0
    private void OnDisable()
    {
        PrefsSurrogate prefs = new PrefsSurrogate();

        prefs.snap_offset = snap_offset;
        prefs.minRotation = minRotation;
        prefs.maxRotation = maxRotation;
        prefs.roundMethod = roundMethod;

        EditorPrefs.SetString(PREFS_PATH, JsonUtility.ToJson(prefs));

        EditorApplication.update -= EditorUpdate;
    }
コード例 #2
0
    public void OnEnable()
    {
        // restore settings
        PrefsSurrogate prefs = JsonUtility.FromJson <PrefsSurrogate>(EditorPrefs.GetString(PREFS_PATH));

        snap_offset = prefs.snap_offset;
        minRotation = prefs.minRotation;
        maxRotation = prefs.maxRotation;
        roundMethod = prefs.roundMethod;

        this.positionProperty     = this.serializedObject.FindProperty("m_LocalPosition");
        this.rotationProperty     = this.serializedObject.FindProperty("m_LocalRotation");
        this.scaleProperty        = this.serializedObject.FindProperty("m_LocalScale");
        icon_revert               = EditorGUIUtility.isProSkin ? Resources.Load("uEditor_Revert_pro") as Texture2D : Resources.Load("uEditor_Revert") as Texture2D;
        icon_locked               = Resources.Load("uEditor_locked") as Texture2D;
        icon_round                = Resources.Load("uEditor_round") as Texture2D;
        icon_unlocked             = Resources.Load("uEditor_unlocked") as Texture2D;
        style_utilLabel           = uEditorUtils.uEditorSkin.GetStyle("UtilLabel");
        style_resetButton         = uEditorUtils.uEditorSkin.GetStyle("ResetButton");
        EditorApplication.update += EditorUpdate;
    }