Files
Cielonos/Packages/io.continis.subassets/Editor/Utilities/ExtensionMap.cs
SoulliesOfficial f26f9fd374 爆更
2026-03-20 12:07:44 -04:00

75 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using SubAssetsToolbox.Editor;
using UnityEditor;
using UnityEditor.Animations;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.U2D;
namespace SubAssetsToolbox.Utilities
{
public static class ExtensionMap
{
public static string GetFileExtensionByType(Type t)
{
if (_extensions.TryGetValue(t, out string ext))
return ext;
else
{
if(!typeof(ScriptableObject).IsAssignableFrom(t))
Debug.LogWarning(Constants.ExtensionDefaultedToAsset);
return "asset";
}
}
private static readonly Dictionary<Type, string> _extensions = new()
{
// Rendering / Shaders
{ typeof(Material), "mat" },
{ typeof(Shader), "shader" },
{ typeof(ComputeShader), "compute" },
{ typeof(ShaderVariantCollection), "shadervariants" },
{ typeof(LightmapParameters), "giparams" },
{ typeof(LightingSettings), "lighting" },
// Animation
{ typeof(AnimationClip), "anim" },
{ typeof(AnimatorController), "controller" },
{ typeof(AnimatorOverrideController), "overrideController" },
{ typeof(AvatarMask), "mask" },
{ typeof(Avatar), "avatar" },
// Physics
#if UNITY_6000_0_OR_NEWER
{ typeof(PhysicsMaterial), "physicsMaterial" },
#else
{ typeof(PhysicMaterial), "physicMaterial" },
#endif
{ typeof(PhysicsMaterial2D), "physicsMaterial2D" },
// Audio
{ typeof(AudioMixer), "mixer" },
// 2D
{ typeof(SpriteAtlas), "spriteatlas" },
// Textures
{ typeof(Cubemap), "cubemap" },
{ typeof(RenderTexture), "rendertexture" },
// 3D
{ typeof(Mesh), "mesh" },
{ typeof(TerrainLayer), "terrainlayer" },
// GUI
{ typeof(Font), "fontsettings" },
{ typeof(GUISkin), "guiskin" },
// Effects
{ typeof(Flare), "flare" },
{ typeof(LightingDataAsset), "lighting" }
};
}
}