同步
This commit is contained in:
@@ -13,45 +13,18 @@ namespace Ichni
|
||||
{
|
||||
public class PostProcessingManager : Singleton<PostProcessingManager>
|
||||
{
|
||||
public static Volume GlobalVolume => instance._globalVolume;
|
||||
public static Volume GlobalVolume => instance.globalVolume;
|
||||
|
||||
[ShowInInspector]
|
||||
private Volume _globalVolume;
|
||||
public Volume globalVolume;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
//FindAndCacheFeatureWithReflection();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
//FindAndCacheFeatureWithReflection();
|
||||
}
|
||||
|
||||
private void FindAndCacheFeatureWithReflection()
|
||||
{
|
||||
var pipelineAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
|
||||
if (pipelineAsset == null)
|
||||
if (globalVolume != null)
|
||||
{
|
||||
Debug.LogError("当前渲染管线不是 UniversalRenderPipelineAsset。");
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 使用反射来获取内部的 m_RendererDataList 字段
|
||||
FieldInfo rendererDataListField =
|
||||
typeof(UniversalRenderPipelineAsset).GetField("m_RendererDataList", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
if (rendererDataListField == null)
|
||||
{
|
||||
Debug.LogError("在 UniversalRenderPipelineAsset 中无法通过反射找到 'm_RendererDataList' 字段。API可能已在你的URP版本中更改。");
|
||||
return;
|
||||
}
|
||||
|
||||
var rendererDataList = rendererDataListField.GetValue(pipelineAsset) as ScriptableRendererData[];
|
||||
if (rendererDataList == null)
|
||||
{
|
||||
Debug.LogError("获取渲染器数据列表失败。");
|
||||
return;
|
||||
// Force instantiate the volume profile on awake so it doesn't happen mid-game
|
||||
_ = globalVolume.profile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user