惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
K
Kaspersky official blog
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
AWS News Blog
AWS News Blog
V2EX - 技术
V2EX - 技术
Google DeepMind News
Google DeepMind News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Security @ Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
Attack and Defense Labs
Attack and Defense Labs
Jina AI
Jina AI
The Last Watchdog
The Last Watchdog
W
WeLiveSecurity
H
Help Net Security
V
Visual Studio Blog
宝玉的分享
宝玉的分享
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threat Research - Cisco Blogs
IT之家
IT之家
Hugging Face - Blog
Hugging Face - Blog
Latest news
Latest news
T
Tor Project blog
I
Intezer
美团技术团队
GbyAI
GbyAI
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
博客园 - 三生石上(FineUI控件)
Google DeepMind News
Google DeepMind News
Scott Helme
Scott Helme
Y
Y Combinator Blog
博客园 - 司徒正美
T
Tenable Blog
O
OpenAI News
N
News and Events Feed by Topic
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V
Vulnerabilities – Threatpost
P
Palo Alto Networks Blog
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Threatpost
Google Online Security Blog
Google Online Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
Help Net Security
Help Net Security

博客园 - 威少小二orz

团结引擎抖音小游戏一定要手动填缓存资源域名 团结引擎发布抖音小游戏(十万个坑已踩完) 团结引擎发布小游戏区分不同平台 团结引擎发布小游戏与js版本SDK的互相调用 Unity发布京东小游戏 LayerMask的使用规范 Unity RectTransform中使用stretch模式时代码动态控制Left、Top、Right、Bottom Unity使用https请求握手失败的处理方案 【MAUI开发】一、初识MAUI Android中使用GSON解析JSON数据 游戏软著渠道的用户协议和隐私协议方案(启动显示方案) C#文件夹复制 C#在Json序列化中动态忽略某些属性或字段 安卓多个Activity大退时自动重启的问题处理 C#中接收到的Json数据中key为数字的问题处理 对于UniWebView这种组件违规获取信息的处理 TapTap实名认证-Android Unity使用Get和Post传递json数据并转换成class对象 Unity获取手机本地应用以及调起apk安装、启动app、安装完成回调 Unity接入穿山甲GroMore广告——重构偏2(Banner广告)
团结引擎+Addressable+Instant Game打包抖音小游戏
威少小二orz · 2026-04-16 · via 博客园 - 威少小二orz

我们在上一篇文件中讲了团结引擎对接抖音小游戏的情况,链接如下:

团结引擎发布抖音小游戏(十万个坑已踩完) - 威少小二orz - 博客园

这篇我们主要讲加入Addressable+Instant Game之后的问题点。

1、Instant Game打包,Copy对应的CDN地址,请注意这个CDN地址是绑定UOS官方后台的CDN地址,需要在后台开启。

image

 2、在Profile配置如下:

首包资源只能选择Package,目前首包选择CDN打包会有一个文件路径找不到而被中断。

首包前缀可不填,但一般还是填一下,和Instant Game中的CDN地址一致。这是从build里走打包。

image

另外,还可以从TT的SDK工具上走打包流程,点图上的ByteGame-TT SDK Tools-Build Tool,先点构建WebGL,再点转换WebGL包。

但是我从这里走经常出现打包报错。所以建议使用上面的Build Setting里的Build。

image

3、https://dummy.dummy.dummy/问题的处理,这个问题是由于adressable的地址没有被instant game自动接管导致的,可能抖音没有进行特殊处理,在微信SDK和最新版的京东SDK里就不会有这个问题。

在Unity里创建一个.cs文件,SkipUnityLogo.cs,不需要挂在任意脚本上,只要放在工程的Assets目录下,

原理是用CDN地址来替换dummy的占位符。

如果你能很好去调整addressable的地址,也就不用管这个问题,最简单的方式是adressable都改为默认地址,这里用CDN的全地址来替换。

如果出现了地址中资源404的情况,是因为CDN那边没有上传或者没有做版本管控,这个在替换地址中去掉release_by_badge/latest这一段即能解决,但我们不要这么做,按正常方式走,接下来会说这个。

#if !UNITY_EDITOR
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Scripting;
 using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.ResourceLocations;
/**
 * 跳过unity-logo
 */
[Preserve]
public class SkipUnityLogo
{
    [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
    private static void BeforeSplashScreen()
    {
#if UNITY_WEBGL
        Application.focusChanged += Application_focusChanged;
#else
        System.Threading.Tasks.Task.Run(AsyncSkip);
#endif
    }
 
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void FixDouYinAddressablePath()
{
   Debug.Log("启动dummy替换0");
#if UNITY_WEBGL
        Debug.Log("启动dummy替换1");
         Addressables.InternalIdTransformFunc = location =>
        {
            string internalId = location.InternalId;

            // 核心:强制把 dummy 域名删掉
            if (internalId.StartsWith("https://dummy.dummy.dummy/"))
            {
                internalId = internalId.Replace("https://dummy.dummy.dummy/", "https://a.unity.cn/client_api/v1/buckets/xxxxxxxxxxxxxxxxxxxxxxxx/release_by_badge/latest/content/");
            }
             Debug.Log("启动dummy替换2");

            // 修复重复路径问题 StreamingAssets/StreamingAssets
            if (internalId.Contains("StreamingAssets/StreamingAssets"))
            {
                internalId = internalId.Replace("StreamingAssets/StreamingAssets/", "StreamingAssets/");
            }

            return internalId;
        };
         Debug.Log("启动dummy替换3");
#endif
}

#if UNITY_WEBGL
    private static void Application_focusChanged(bool obj)
    {
        Application.focusChanged -= Application_focusChanged;
        SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
    }
#else
    private static void AsyncSkip()
    {
        SplashScreen.Stop(SplashScreen.StopBehavior.StopImmediate);
    }
#endif
}
#endif

 4、在UOS的存储桶的页面,下载CLI工具,windows版本。

image

 下载之后,使用命令行打开,

第1步:

在cmd里输入:(根据你的路径去修改)

cd /d C:\Users\admin\Downloads\uas_win_V1.0.9 && uas.exe

 第2步输入:

(自己替换xxxx的ID,分别为uos的appid和app secret,uos后台直接复制全命令即可)

uas auth login --uos_app_id xxxxxxxxxx --uos_app_service_secret xxxxxxxxxxxx

之前是uos_app_secret ,但后面接的参数是uos_app_service_secret的,官方把字段做了一次修正

第3步输入:

(xxxxx为你存储桶的ID,也是CDN地址中v1/buckets/后面的一段)

(respath为你build结束后的webgl的目录C:\MyGame\ByteGameOutput\webgl)

uas entries sync --bucket xxxxxxxxxxxxx  respath

例:

uas entries sync --bucket xxxxxxxxxxxxx  C:\MyGame\ByteGameOutput\webgl

重点关注:后面的路径当中不可以有空格,否则CLI的上传可能会有问题。

这样会上传你当前的build里的资源,但是没有做版本管理。

第4步:增加版本管理

(xxxxx为你存储桶的ID,也是CDN地址中v1/buckets/后面的一段)

uas releases create --bucket xxxxxxxxxxxxxx --notes "LastestUpload"

这4步上传完成后,就等于资源全部上传完了。

然后用抖音扫码进入游戏,如果CDN上不这么处理,你可能拉不到新资源,每次都拉到旧版。

注意需要填写一下不缓存的资源如下:

json
xml
db
version