浏览代码

Propertly Initializing asset resources when a new Lightweight pipeline is created.

/main
Felipe Lira 7 年前
当前提交
048d72e1
共有 1 个文件被更改,包括 27 次插入3 次删除
  1. 30
      ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs

30
ScriptableRenderPipeline/LightweightPipeline/LightweightPipelineAsset.cs


static void CreateLightweightPipeline()
{
var instance = CreateInstance<LightweightPipelineAsset>();
string[] guids = AssetDatabase.FindAssets("Lightweight-Default t:material");
string[] paths = new string[guids.Length];
for (int i = 0; i < guids.Length; ++i)
{
string guid = guids[i];
paths[i] = AssetDatabase.GUIDToAssetPath(guid);
}
foreach (string path in paths)
{
Material material = AssetDatabase.LoadAssetAtPath<Material>(path);
if (path.Length == 0)
continue;
if (path.Contains("Terrain"))
instance.m_DefaultTerrainMaterial = material;
else if (path.Contains("Particle"))
instance.m_DefaultParticleMaterial = material;
else
instance.m_DefaultMaterial = material;
}
string path = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Lightweight Asset", "LightweightAsset", "asset",
string assetPath = UnityEditor.EditorUtility.SaveFilePanelInProject("Save Lightweight Asset", "LightweightAsset", "asset",
if (path.Length > 0)
UnityEditor.AssetDatabase.CreateAsset(instance, path);
if (assetPath.Length > 0)
UnityEditor.AssetDatabase.CreateAsset(instance, assetPath);
}
#endif

正在加载...
取消
保存