forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostProcessingFactory.cs
More file actions
executable file
·34 lines (31 loc) · 1.27 KB
/
Copy pathPostProcessingFactory.cs
File metadata and controls
executable file
·34 lines (31 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using UnityEngine;
using UnityEngine.PostProcessing;
using UnityEditor.ProjectWindowCallback;
using System.IO;
namespace UnityEditor.PostProcessing
{
public class PostProcessingFactory
{
[MenuItem("Assets/Create/Post-Processing Profile", priority = 201)]
static void MenuCreatePostProcessingProfile()
{
var icon = (Texture2D)null; // TODO: Post-processing profile texture
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DoCreatePostProcessingProfile>(), "New Post-Processing Profile.asset", icon, null);
}
internal static PostProcessingProfile CreatePostProcessingProfileAtPath(string path)
{
var profile = ScriptableObject.CreateInstance<PostProcessingProfile>();
profile.name = Path.GetFileName(path);
AssetDatabase.CreateAsset(profile, path);
return profile;
}
}
class DoCreatePostProcessingProfile : EndNameEditAction
{
public override void Action(int instanceId, string pathName, string resourceFile)
{
PostProcessingProfile profile = PostProcessingFactory.CreatePostProcessingProfileAtPath(pathName);
ProjectWindowUtil.ShowCreatedAsset(profile);
}
}
}