forked from SixWays/UnityShaderStripper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ShaderStripperPath.cs
37 lines (34 loc) · 1.11 KB
/
ShaderStripperPath.cs
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
35
36
37
#if UNITY_2018_2_OR_NEWER
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UnityEngine;
using UnityEngine.Rendering;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Rendering;
#endif
namespace Sigtrap.Editors.ShaderStripper {
/// <summary>
/// Strips shaders by shader asset path.
/// </summary>
[CreateAssetMenu(menuName="Sigtrap/Shader Stripper Path")]
public class ShaderStripperPath : ShaderStripperBase {
[SerializeField]
StringMatch[] _pathBlacklist;
#if UNITY_EDITOR
protected override bool _checkPass {get {return false;}}
protected override bool _checkVariants {get {return false;}}
protected override bool _checkShader {get {return true;}}
protected override bool MatchShader(Shader shader){
string path = AssetDatabase.GetAssetPath(shader);
if (string.IsNullOrEmpty(path)) return false;
foreach (var p in _pathBlacklist){
if (p.Evaluate(path)) return true;
}
return false;
}
#endif
}
}
#endif