mirror of
https://github.com/FalloutCollaborationProject/FCP-Tools.git
synced 2026-07-27 16:59:37 -07:00
28 lines
848 B
C#
28 lines
848 B
C#
using FCP.Core.VATS;
|
|
using UnityEngine;
|
|
|
|
namespace FCP.Core.Unity;
|
|
|
|
[StaticConstructorOnStartup]
|
|
public static class Materials
|
|
{
|
|
private static Dictionary<string, Material> _lookupMaterials;
|
|
|
|
public static readonly Material ZoomMat = LoadMaterial(Path.Combine("Assets", "Shaders", "Unlit_ZoomShader.mat"));
|
|
|
|
public static Material LoadMaterial(string materialName)
|
|
{
|
|
_lookupMaterials ??= new Dictionary<string, Material>();
|
|
if (!_lookupMaterials.ContainsKey(materialName))
|
|
{
|
|
_lookupMaterials[materialName] = VATSMod.Instance.MainBundle.LoadAsset<Material>(materialName);
|
|
}
|
|
|
|
Material mat = _lookupMaterials[materialName];
|
|
if (mat != null)
|
|
return mat;
|
|
|
|
FCPLog.Warning($"Could not load material: {materialName}");
|
|
return null;
|
|
}
|
|
} |