forked from BilalY/Rasagar
32 lines
1.2 KiB
C#
32 lines
1.2 KiB
C#
using System.IO;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.HighDefinition;
|
|
using UnityEngine.Rendering;
|
|
|
|
namespace UnityEditor.Rendering.HighDefinition
|
|
{
|
|
using UnityObject = UnityEngine.Object;
|
|
|
|
static partial class HDAssetFactory
|
|
{
|
|
class DoCreateNewAssetHDRenderPipeline : ProjectWindowCallback.EndNameEditAction
|
|
{
|
|
public override void Action(int instanceId, string pathName, string resourceFile)
|
|
{
|
|
var newAsset = CreateInstance<HDRenderPipelineAsset>();
|
|
newAsset.name = Path.GetFileName(pathName);
|
|
|
|
AssetDatabase.CreateAsset(newAsset, pathName);
|
|
ProjectWindowUtil.ShowCreatedAsset(newAsset);
|
|
}
|
|
}
|
|
|
|
[MenuItem("Assets/Create/Rendering/HDRP Asset", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateRenderingMenuPriority)]
|
|
static void CreateHDRenderPipeline()
|
|
{
|
|
var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon");
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DoCreateNewAssetHDRenderPipeline>(), "New HDRenderPipelineAsset.asset", icon, null);
|
|
}
|
|
}
|
|
}
|