您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
1.1 KiB
43 行
1.1 KiB
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
using UnityEngine.Experimental.Rendering.HDPipeline;
|
|
|
|
[ExecuteInEditMode]
|
|
public class MotionBlurQuality : MonoBehaviour {
|
|
|
|
[Range(4, 32)]
|
|
public int normalSamples = 5;
|
|
[Range(4, 32)]
|
|
public int highSamples = 12;
|
|
[Range(4, 32)]
|
|
public int ultraSamples = 24;
|
|
|
|
// Use this for initialization
|
|
void OnEnable ()
|
|
{
|
|
var volume = GetComponent<Volume>();
|
|
if (volume == null)
|
|
return;
|
|
MotionBlur m_motionBlur;
|
|
|
|
var profile = Application.isPlaying
|
|
? volume.profile
|
|
: volume.sharedProfile;
|
|
|
|
profile.TryGet<MotionBlur>(out m_motionBlur);
|
|
|
|
switch(QualitySettings.GetQualityLevel())
|
|
{
|
|
case 0:
|
|
m_motionBlur.sampleCount.value = normalSamples;
|
|
break;
|
|
case 1:
|
|
m_motionBlur.sampleCount.value = highSamples;
|
|
break;
|
|
case 2:
|
|
m_motionBlur.sampleCount.value = ultraSamples;
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|