示例#1
0
            public override void Action(int instanceId, string pathName, string resourceFile)
            {
                var instance = CreateInstance <LightweightPipelineAsset>();

                string[] guids = AssetDatabase.FindAssets("LightweightPipelineResource t:scriptableobject", m_SearchPaths);
                LightweightPipelineResource resourceAsset = null;

                foreach (string guid in guids)
                {
                    string path = AssetDatabase.GUIDToAssetPath(guid);
                    resourceAsset = AssetDatabase.LoadAssetAtPath <LightweightPipelineResource>(path);
                    if (resourceAsset != null)
                    {
                        break;
                    }
                }

                // There's currently an issue that prevents FindAssets from find resources withing the package folder.
                if (resourceAsset == null)
                {
                    string path = m_SearchPaths[PACKAGE_MANAGER_PATH_INDEX] + "/LWRP/Data/LightweightPipelineResource.asset";
                    resourceAsset = AssetDatabase.LoadAssetAtPath <LightweightPipelineResource>(path);
                }

                instance.m_ResourceAsset   = resourceAsset;
                instance.m_DefaultShader   = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
                instance.m_BlitShader      = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_BLIT));
                instance.m_CopyDepthShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.HIDDEN_DEPTH_COPY));

                AssetDatabase.CreateAsset(instance, pathName);
            }
 public override Shader GetDefaultShader()
 {
     if (m_DefaultShader == null)
     {
         m_DefaultShader = Shader.Find(LightweightShaderUtils.GetShaderPath(ShaderPathID.STANDARD_PBS));
     }
     return(m_DefaultShader);
 }