浏览代码

Do lazy evaluation for ReflectionProbePreview material

/main
Sebastien Lagarde 7 年前
当前提交
0f30f74a
共有 1 个文件被更改,包括 10 次插入4 次删除
  1. 14
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs

14
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Lighting/Reflection/HDReflectionProbeEditorUtility.cs


[InitializeOnLoadMethod]
static void Initialize()
{
s_PreviewMaterial = new Material(Shader.Find("Debug/ReflectionProbePreview"))
{
hideFlags = HideFlags.HideAndDontSave
};
s_SphereMesh = Resources.GetBuiltinResource(typeof(Mesh), "New-Sphere.fbx") as Mesh;
}

var meshRenderer = p.GetComponent<MeshRenderer>() ?? p.gameObject.AddComponent<MeshRenderer>();
meshFilter.sharedMesh = s_SphereMesh;
// Lazy evaluation attempt to avoid shader compil error issue in Editor (The shader is not found the first time
// we load after deleting Library folder)
if (s_PreviewMaterial == null)
{
s_PreviewMaterial = new Material(Shader.Find("Debug/ReflectionProbePreview"))
{
hideFlags = HideFlags.HideAndDontSave
};
}
var material = meshRenderer.sharedMaterial;
if (material == null

正在加载...
取消
保存