Unity Spine specifies the default material for importing new Spine animations

Find Spine’s Editor import configuration

Usually in Assets/Editor/SpineSettings.asset

Insert image description here
The configuration file corresponds to the Edit/Preferences/Spine tab
Insert image description here

  • Default Mix. Set the Default Mix Duration of newly imported SkeletonDataAssets.
  • Default SkeletonData Scale. Sets the default Scale value for newly imported SkeletonDataAssets.
  • Default Shader. Sets the default shader used by newly imported skeleton atlas textures when creating materials.
  • Apply Atlas Texture Settings. Apply the referenced Atlas Texture Settings to the texture importer specified below.
  • Atlas Texture Settings. Applies the selected texture import settings on newly imported atlas textures and materials. When exporting atlas textures from Spine with Premultiply alpha enabled (default to this), you can keep it as PMATexturePreset. If you have disabled Premultiply alpha, please set it to StraightAlphaTexturePreset. You can also create your own TextureImporter Preset asset and assign it here.
  • Additive Material. Set the slot blend mode to the Material template of Additive. For details, see SkeletonData Blend Mode Materials.
  • Multiply Material. Set the slot blend mode to the Material template of Multiply. For details, see SkeletonData Blend Mode Materials.
  • Screen Material. Set the slot blend mode to the Material template of Screen. For details, see SkeletonData Blend Mode Materials.

How to modify

Method 1: You can modify the Assets/Editor/SpineSettings.asset file through a script

   [MenuItem( "Tools/Spine/Change Spine default shader" )]
    public static void ChangeSpineDefaultShader( )
    {
    
    
        SetDefaultShaderForSpine( "Spine/Skeleton Fill" );
    }

    public static void SetDefaultShaderForSpine( string shaderName )
    {
    
    
        Shader shader = Shader.Find( shaderName );
        Debug.Assert( shader != null, $"There is no {
     
     {
     
     {
      
      shaderName}}} shader." );

        var guids = AssetDatabase.FindAssets( "t:SpinePreferences" );
        string assetPath = AssetDatabase.GUIDToAssetPath( guids[ 0 ] );
        SpinePreferences asset = AssetDatabase.LoadAssetAtPath<SpinePreferences>( assetPath );
        if ( asset != null )
        {
    
    
            asset.defaultShader = shaderName;
        }
        EditorUtility.SetDirty( asset );
        AssetDatabase.SaveAssetIfDirty( asset );
    }

Method 2: Manual settings through the panel

Insert image description here

おすすめ

転載: blog.csdn.net/qq_39162566/article/details/134019011