浏览代码

Added null check on CreateEngineMaterial

/main
Felipe Lira 7 年前
当前提交
f48ba219
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 15
      ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs

15
ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs


// Unity specifics
public static Material CreateEngineMaterial(string shaderPath)
{
var mat = new Material(Shader.Find(shaderPath))
Shader shader = Shader.Find(shaderPath);
if (shader == null)
{
Debug.LogError("Cannot create required material because shader " + shaderPath + " could not be found");
return null;
}
var mat = new Material(shader)
{
hideFlags = HideFlags.HideAndDontSave
};

public static Material CreateEngineMaterial(Shader shader)
{
if (shader == null)
{
Debug.LogError("Cannot create required material because shader is null");
return null;
}
var mat = new Material(shader)
{
hideFlags = HideFlags.HideAndDontSave

正在加载...
取消
保存