ShaderUtils.Editor.cs•1.4 kB
/*
┌──────────────────────────────────────────────────────────────────┐
│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
│ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │
│ Copyright (c) 2025 Ivan Murzak │
│ Licensed under the Apache License, Version 2.0. │
│ See the LICENSE file in the project root for more information. │
└──────────────────────────────────────────────────────────────────┘
*/
#nullable enable
#if UNITY_EDITOR
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace com.IvanMurzak.Unity.MCP.Runtime.Utils
{
public static partial class ShaderUtils
{
public static IEnumerable<Shader> GetAllShaders()
{
var shaderGuids = AssetDatabase.FindAssets("t:Shader");
return shaderGuids
.Select(guid => AssetDatabase.GUIDToAssetPath(guid))
.Select(path => AssetDatabase.LoadAssetAtPath<Shader>(path))
.Where(shader => shader != null);
}
}
}
#endif