浏览代码

[HDRenderPipelineEditor] Use serialization callback instead of OnValidate to copy runtime data

/main
Frédéric Vauchelles 7 年前
当前提交
b1dace38
共有 1 个文件被更改,包括 14 次插入19 次删除
  1. 33
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipelineAsset.cs

33
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipelineAsset.cs


namespace UnityEngine.Experimental.Rendering.HDPipeline
namespace UnityEngine.Experimental.Rendering.HDPipeline
public class HDRenderPipelineAsset : RenderPipelineAsset
public class HDRenderPipelineAsset : RenderPipelineAsset, ISerializationCallbackReceiver
{
HDRenderPipelineAsset()
{

return m_FrameSettings;
}
public void OnEnable()
{
// At creation we need to copy serializedFrameSettings to m_FrameSettings
OnValidate();
}
public void OnValidate()
{
// Modification of defaultFrameSettings in the inspector will call OnValidate().
// We do a copy of the settings to those effectively used
serializedFrameSettings.CopyTo(m_FrameSettings);
// All instance created in the editor have obsolete settings
// So we must dispose them
DestroyCreatedInstances();
}
// Store the various RenderPipelineSettings for each platform (for now only one)
public RenderPipelineSettings renderPipelineSettings = new RenderPipelineSettings();

[SerializeField]
public SubsurfaceScatteringSettings sssSettings;
ISerializationCallbackReceiver m_SerializationCallbackReceiverImplementation;
public override Shader GetDefaultShader()
{

public override Material GetDefault2DMaterial()
{
return null;
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
// Modification of defaultFrameSettings in the inspector will call OnValidate().
// We do a copy of the settings to those effectively used
serializedFrameSettings.CopyTo(m_FrameSettings);
}
}
}
正在加载...
取消
保存