public static bool Foldout(string label, string prefkeys, bool defaultValue = true) { string prefKey = JEditorCommon.GetProjectRelatedEditorPrefsKey("foldout", prefkeys); bool expanded = EditorPrefs.GetBool(prefKey, defaultValue); expanded = EditorGUILayout.Foldout(expanded, label); EditorPrefs.SetBool(prefKey, expanded); return(expanded); }
private void OnDisable() { EditorPrefs.SetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_POS_X), CameraPosition.x); EditorPrefs.SetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_POS_Y), CameraPosition.y); EditorPrefs.SetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_POS_Z), CameraPosition.z); EditorPrefs.SetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_NEAR_PLANE), CameraNearPlane); EditorPrefs.SetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_FAR_PLANE), CameraFarPlane); EditorPrefs.SetInt(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_CLEAR_FLAG), (int)CameraClearFlag); EditorPrefs.SetString(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_BG_COLOR), ColorUtility.ToHtmlStringRGB(CameraBackgroundColor)); EditorPrefs.SetInt(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, RESOLUTION), Resolution); EditorPrefs.SetBool(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, EXPORT_FACE_TEXTURES), ExportFaceTextures); EditorPrefs.SetString(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, DIRECTORY), Directory); }
private void OnEnable() { float x = EditorPrefs.GetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_POS_X), 0); float y = EditorPrefs.GetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_POS_Y), 0); float z = EditorPrefs.GetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_POS_Z), 0); CameraPosition = new Vector3(x, y, z); CameraNearPlane = EditorPrefs.GetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_NEAR_PLANE), 0); CameraFarPlane = EditorPrefs.GetFloat(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_FAR_PLANE), 1000); CameraClearFlag = (CameraClearFlags)EditorPrefs.GetInt(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_CLEAR_FLAG), 0); string htmlColor = EditorPrefs.GetString(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, CAM_BG_COLOR), "FFFFFF"); Color c = Color.white; ColorUtility.TryParseHtmlString("#" + htmlColor, out c); CameraBackgroundColor = c; Resolution = EditorPrefs.GetInt(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, RESOLUTION), 512); ExportFaceTextures = EditorPrefs.GetBool(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, EXPORT_FACE_TEXTURES), false); Directory = EditorPrefs.GetString(JEditorCommon.GetProjectRelatedEditorPrefsKey(PREF_PREFIX, DIRECTORY), "Assets/"); }
public static void ExpandFoldout(string id) { string prefKey = JEditorCommon.GetProjectRelatedEditorPrefsKey("foldout", id); EditorPrefs.SetBool(prefKey, true); }