三国卡牌客户端基础资源仓库
hch
2025-09-15 dc42f84d8e06a1782821d2063e4438656794d80f
0312 去掉unitylogo,闪图大小问题,加载材质问题
2个文件已修改
14个文件已添加
412 ■■■■■ 已修改文件
Assets/Editor/Tool/ClientPackage.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/UpdateAssetBundleName.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo.meta 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Readme.md 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Readme.md.meta 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Script.meta 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Script/Editor.meta 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Script/Editor/SplashScreenSetting.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Script/Editor/SplashScreenSetting.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Script/SkipUnityLogo.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/Script/SkipUnityLogo.cs.meta 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/img.meta 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/img/BlackSplashScreenMask.png 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/img/BlackSplashScreenMask.png.meta 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/img/WhiteSplashScreenMask.png 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/SkipUnityLogo/img/WhiteSplashScreenMask.png.meta 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Editor/Tool/ClientPackage.cs
@@ -741,15 +741,15 @@
        var splashScreenLogo = PlayerSettings.SplashScreenLogo.Create(3, splashImage);
        PlayerSettings.SplashScreen.logos = new PlayerSettings.SplashScreenLogo[] { splashScreenLogo };
        // if (buildTarget == BuildTargetGroup.Android)
        // {
        //     var projectSettings = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/ProjectSettings.asset")[0]);
        //     var splashImageSetting = projectSettings.FindProperty("androidSplashScreen");
        //     splashImageSetting.objectReferenceValue = splashImage.texture;
        //     projectSettings.ApplyModifiedProperties();
        if (buildTarget == BuildTargetGroup.Android)
        {
            var projectSettings = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/ProjectSettings.asset")[0]);
            var splashImageSetting = projectSettings.FindProperty("androidSplashScreen");
            splashImageSetting.objectReferenceValue = splashImage.texture;
            projectSettings.ApplyModifiedProperties();
        //     PlayerSettings.Android.splashScreenScale = AndroidSplashScreenScale.ScaleToFill;
        // }
            PlayerSettings.Android.splashScreenScale = AndroidSplashScreenScale.ScaleToFill;
        }
    }
    public static void SetCreateRoleAnimation()
Assets/Editor/Tool/UpdateAssetBundleName.cs
@@ -116,7 +116,7 @@
            // EditorUtility.SetDirty(importer);
        }
        guids = AssetDatabase.FindAssets("t:Material", new string[] { assetRelativePath });
        guids = AssetDatabase.FindAssets("t:Material", new string[] { "Assets/ResourcesOut/Materials" });
        foreach (var guid in guids)
        {
            var path = AssetDatabase.GUIDToAssetPath(guid);
Assets/Launch/SkipUnityLogo.meta
New file
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b18ad63a3387dd4a87604c62109fb43
folderAsset: yes
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/Readme.md
New file
@@ -0,0 +1,30 @@
## 在游戏启动时取消 unity logo
- #### 使用方法
  - ##### 将 SkipUnityLogo 这个文件夹放在 Assets 下的任意路径
  - ##### 在编辑器上方的工具栏 EditorTools/SkipUnityLogo 下,有两个我做的快速设置启动画面的选项
    - 设置启动画面为黑色背景 ------ 适用于你自定义的 Logo 是纯白的
    - 设置启动画面为白色背景 ------ 适用于你自定义的 Logo 是纯黑的
  - ##### 附带了我从 UnityChan 的包里提取的启动画面场景,可以用来测试一下
    1.  在 File-> BuildSetting 里把 <b>SplashScreen_Dark(对应黑色背景启动画面)</b>或者 <b>SplashScreen_Light(对应白色背景启动画面)</b>拖进去设置为第一个(右边索引为 0)
    2.  Build 打包出去,enjoy!
- #### 原理
  - 在 2019.2 以后的版本,unity 官方“好心”的在脚本 api 中加入了能停止绘制启动画面的方法和枚举:
    - 在 UnityEngine.Rendering 下面的 SplashScreen 类,有一个 Stop 方法
    - `public static void Stop(Rendering.SplashScreen.StopBehavior stopBehavior);`
      只要传入这个枚举,就可以立即停止渲染 unity 启动 logo
    - `SplashScreen.StopBehavior.StopImmediate`
      <br/>
    - 这样还不行,还是会有启动 logo(<b>如果你写的这个类继承了 MonoBehavior,并挂在第一个场景的任意 GameObject 上也不行,因为想要执行这个脚本,就必须得先加载包含这个 GameObject 的场景,而启动画面是在场景加载前渲染的,所以行不通</b>),原因在于它根本不会被执行,所以还需要在你写的方法调用 Stop() 前加上:`RuntimeInitializeOnLoadMethodAttribute` 这个特性,
      用它另一个重载,能接收 RuntimeInitializeLoadType 枚举参数的这个:<br/>`RuntimeInitializeOnLoadMethodAttribute ( RuntimeInitializeLoadType loadType )`<br/>
      它有一个枚举叫`RuntimeInitializeLoadType.BeforeSplashScreen`,把这个传进去就可以了<br/>
      即: `[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]`
      <br/>
  - 已经实现了跳过启动 logo,但是效果还不够好,现在运行打包好的程序你会发现画面会灰一下,原因在于:
    - 调用 stop()它实际上是直接跳到渲染完启动 logo 的最后一帧,而且在 ProjectSettings->Player->SplashImage 选项卡下,它默认使用的是设置好的背景颜色(Background Color),就算你调成了纯黑(或纯白),不透明度(Overlay Opacity)它不让你调到 50%以下,所以才会出现这种情况。
  - 解决办法:虽然不透明度有限制,但是它有背景图片(BackgroudImage)的选项,所以最简单的办法就是,去 ps 里做一张很小的图片遮罩,填充纯黑(或纯白),然后放在 BackgroudImage 上 把不透明度调成 1,完全盖住下面的颜色,就解决了
Assets/Launch/SkipUnityLogo/Readme.md.meta
New file
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fbbcbbb4f5c9d584880734e3103d27f9
TextScriptImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/Script.meta
New file
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91f4b81cbb284bf459f7072abf371e96
folderAsset: yes
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/Script/Editor.meta
New file
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 97a1d4055bcd82440bd073bc0abf37b5
folderAsset: yes
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/Script/Editor/SplashScreenSetting.cs
New file
@@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
#if UNITY_EDITOR
public class SplashScreenSetting : MonoBehaviour
{
    const string BlackMenuPath = "EditorTools/SkipUnityLogo/SetBG_Black";
    const string WhiteMenuPath = "EditorTools/SkipUnityLogo/SetBG_White";
    [MenuItem(BlackMenuPath)]
    static void BlackSplashScreen()
    {
        Sprite background = AssetDatabase.LoadAssetAtPath("Assets/SkipUnityLogo/img/BlackSplashScreenMask.png", typeof(Sprite)) as Sprite;
        PlayerSettings.SplashScreen.background = background;
        PlayerSettings.SplashScreen.unityLogoStyle = PlayerSettings.SplashScreen.UnityLogoStyle.LightOnDark;
        PlayerSettings.SplashScreen.animationMode = PlayerSettings.SplashScreen.AnimationMode.Static;
        PlayerSettings.SplashScreen.overlayOpacity = 1;
        PlayerSettings.SplashScreen.drawMode = PlayerSettings.SplashScreen.DrawMode.UnityLogoBelow;
        PlayerSettings.SplashScreen.blurBackgroundImage = false;
        print("black ok");
    }
    [MenuItem(WhiteMenuPath)]
    static void WhiteSplashScreen()
    {
        Sprite background = AssetDatabase.LoadAssetAtPath("Assets/SkipUnityLogo/img/WhiteSplashScreenMask.png", typeof(Sprite)) as Sprite;
        PlayerSettings.SplashScreen.background = background;
        PlayerSettings.SplashScreen.unityLogoStyle = PlayerSettings.SplashScreen.UnityLogoStyle.DarkOnLight;
        PlayerSettings.SplashScreen.animationMode = PlayerSettings.SplashScreen.AnimationMode.Static;
        PlayerSettings.SplashScreen.overlayOpacity = 1;
        PlayerSettings.SplashScreen.drawMode = PlayerSettings.SplashScreen.DrawMode.UnityLogoBelow;
        PlayerSettings.SplashScreen.blurBackgroundImage = false;
        print("white ok");
    }
}
#endif
Assets/Launch/SkipUnityLogo/Script/Editor/SplashScreenSetting.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3a8b2e7b1eb4c8b4a9aec333c9d5edf6
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/Script/SkipUnityLogo.cs
New file
@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Scripting;
[Preserve]
public class SkipUnityLogo
{
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
    private static void CancelSplashScreen()
    {
        Task.Run(()=>SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate));
    }
}
Assets/Launch/SkipUnityLogo/Script/SkipUnityLogo.cs.meta
New file
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: db26c63d0a944504c93febec94e8dd97
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/img.meta
New file
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9c8ce5b57d43584596f901ad174a4f5
folderAsset: yes
DefaultImporter:
  externalObjects: {}
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/img/BlackSplashScreenMask.png
Assets/Launch/SkipUnityLogo/img/BlackSplashScreenMask.png.meta
New file
@@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: fe84f891634f0f24aa312c80dc20822a
TextureImporter:
  internalIDToNameTable: []
  externalObjects: {}
  serializedVersion: 12
  mipmaps:
    mipMapMode: 0
    enableMipMap: 0
    sRGBTexture: 1
    linearTexture: 0
    fadeOut: 0
    borderMipMap: 0
    mipMapsPreserveCoverage: 0
    alphaTestReferenceValue: 0.5
    mipMapFadeDistanceStart: 1
    mipMapFadeDistanceEnd: 3
  bumpmap:
    convertToNormalMap: 0
    externalNormalMap: 0
    heightScale: 0.25
    normalMapFilter: 0
    flipGreenChannel: 0
  isReadable: 0
  streamingMipmaps: 0
  streamingMipmapsPriority: 0
  vTOnly: 0
  ignoreMipmapLimit: 0
  grayScaleToAlpha: 0
  generateCubemap: 6
  cubemapConvolution: 0
  seamlessCubemap: 0
  textureFormat: 1
  maxTextureSize: 2048
  textureSettings:
    serializedVersion: 2
    filterMode: 1
    aniso: 1
    mipBias: 0
    wrapU: 1
    wrapV: 1
    wrapW: 0
  nPOTScale: 0
  lightmap: 0
  compressionQuality: 50
  spriteMode: 1
  spriteExtrude: 1
  spriteMeshType: 1
  alignment: 0
  spritePivot: {x: 0.5, y: 0.5}
  spritePixelsToUnits: 100
  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
  spriteGenerateFallbackPhysicsShape: 1
  alphaUsage: 1
  alphaIsTransparency: 1
  spriteTessellationDetail: -1
  textureType: 8
  textureShape: 1
  singleChannelComponent: 0
  flipbookRows: 1
  flipbookColumns: 1
  maxTextureSizeSet: 0
  compressionQualitySet: 0
  textureFormatSet: 0
  ignorePngGamma: 0
  applyGammaDecoding: 0
  swizzle: 50462976
  cookieLightType: 0
  platformSettings:
  - serializedVersion: 3
    buildTarget: DefaultTexturePlatform
    maxTextureSize: 2048
    resizeAlgorithm: 0
    textureFormat: -1
    textureCompression: 1
    compressionQuality: 50
    crunchedCompression: 0
    allowsAlphaSplitting: 0
    overridden: 0
    androidETC2FallbackOverride: 0
    forceMaximumCompressionQuality_BC6H_BC7: 0
  - serializedVersion: 3
    buildTarget: Standalone
    maxTextureSize: 2048
    resizeAlgorithm: 0
    textureFormat: -1
    textureCompression: 1
    compressionQuality: 50
    crunchedCompression: 0
    allowsAlphaSplitting: 0
    overridden: 0
    androidETC2FallbackOverride: 0
    forceMaximumCompressionQuality_BC6H_BC7: 0
  - serializedVersion: 3
    buildTarget: Server
    maxTextureSize: 2048
    resizeAlgorithm: 0
    textureFormat: -1
    textureCompression: 1
    compressionQuality: 50
    crunchedCompression: 0
    allowsAlphaSplitting: 0
    overridden: 0
    androidETC2FallbackOverride: 0
    forceMaximumCompressionQuality_BC6H_BC7: 0
  spriteSheet:
    serializedVersion: 2
    sprites: []
    outline: []
    physicsShape: []
    bones: []
    spriteID: 5e97eb03825dee720800000000000000
    internalID: 0
    vertices: []
    indices:
    edges: []
    weights: []
    secondaryTextures: []
    nameFileIdTable: {}
  mipmapLimitGroupName:
  pSDRemoveMatte: 0
  userData:
  assetBundleName:
  assetBundleVariant:
Assets/Launch/SkipUnityLogo/img/WhiteSplashScreenMask.png
Assets/Launch/SkipUnityLogo/img/WhiteSplashScreenMask.png.meta
New file
@@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: 35b7e4fbed0cd3843b8ccb0e8db18e42
TextureImporter:
  internalIDToNameTable: []
  externalObjects: {}
  serializedVersion: 12
  mipmaps:
    mipMapMode: 0
    enableMipMap: 0
    sRGBTexture: 1
    linearTexture: 0
    fadeOut: 0
    borderMipMap: 0
    mipMapsPreserveCoverage: 0
    alphaTestReferenceValue: 0.5
    mipMapFadeDistanceStart: 1
    mipMapFadeDistanceEnd: 3
  bumpmap:
    convertToNormalMap: 0
    externalNormalMap: 0
    heightScale: 0.25
    normalMapFilter: 0
    flipGreenChannel: 0
  isReadable: 0
  streamingMipmaps: 0
  streamingMipmapsPriority: 0
  vTOnly: 0
  ignoreMipmapLimit: 0
  grayScaleToAlpha: 0
  generateCubemap: 6
  cubemapConvolution: 0
  seamlessCubemap: 0
  textureFormat: 1
  maxTextureSize: 2048
  textureSettings:
    serializedVersion: 2
    filterMode: 1
    aniso: 1
    mipBias: 0
    wrapU: 1
    wrapV: 1
    wrapW: 0
  nPOTScale: 0
  lightmap: 0
  compressionQuality: 50
  spriteMode: 1
  spriteExtrude: 1
  spriteMeshType: 1
  alignment: 0
  spritePivot: {x: 0.5, y: 0.5}
  spritePixelsToUnits: 100
  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
  spriteGenerateFallbackPhysicsShape: 1
  alphaUsage: 1
  alphaIsTransparency: 1
  spriteTessellationDetail: -1
  textureType: 8
  textureShape: 1
  singleChannelComponent: 0
  flipbookRows: 1
  flipbookColumns: 1
  maxTextureSizeSet: 0
  compressionQualitySet: 0
  textureFormatSet: 0
  ignorePngGamma: 0
  applyGammaDecoding: 0
  swizzle: 50462976
  cookieLightType: 0
  platformSettings:
  - serializedVersion: 3
    buildTarget: DefaultTexturePlatform
    maxTextureSize: 2048
    resizeAlgorithm: 0
    textureFormat: -1
    textureCompression: 1
    compressionQuality: 50
    crunchedCompression: 0
    allowsAlphaSplitting: 0
    overridden: 0
    androidETC2FallbackOverride: 0
    forceMaximumCompressionQuality_BC6H_BC7: 0
  - serializedVersion: 3
    buildTarget: Standalone
    maxTextureSize: 2048
    resizeAlgorithm: 0
    textureFormat: -1
    textureCompression: 1
    compressionQuality: 50
    crunchedCompression: 0
    allowsAlphaSplitting: 0
    overridden: 0
    androidETC2FallbackOverride: 0
    forceMaximumCompressionQuality_BC6H_BC7: 0
  - serializedVersion: 3
    buildTarget: Server
    maxTextureSize: 2048
    resizeAlgorithm: 0
    textureFormat: -1
    textureCompression: 1
    compressionQuality: 50
    crunchedCompression: 0
    allowsAlphaSplitting: 0
    overridden: 0
    androidETC2FallbackOverride: 0
    forceMaximumCompressionQuality_BC6H_BC7: 0
  spriteSheet:
    serializedVersion: 2
    sprites: []
    outline: []
    physicsShape: []
    bones: []
    spriteID: 5e97eb03825dee720800000000000000
    internalID: 0
    vertices: []
    indices:
    edges: []
    weights: []
    secondaryTextures: []
    nameFileIdTable: {}
  mipmapLimitGroupName:
  pSDRemoveMatte: 0
  userData:
  assetBundleName:
  assetBundleVariant: