最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

Unity_Addressable_Addressables and SpriteAtlases(打包和圖集)

2023-04-04 10:49 作者:unity_某某師_高錦錦  | 我要投稿

Some SpriteAtlas options can change how Unity loads Sprites. This is important to consider if you want to use the?Use Asset Database?Play Mode Script.

譯:一些SpriteAtlas選項可以更改Unity加載Sprites的方式。如果要使用Use Asset Database Play Mode Script,則需要考慮這一點

The following examples demonstrate how Addressables handles SpriteAtlases differently than other Assets:

譯:以下示例演示了Addressables如何與SpriteAtlases處理方式不同于其他資產(chǎn):

Addressable Sprites

Example 1:

You have three Addressable textures in three separate groups, where each texture builds to around 500KB. Since they exist in separate groups, Unity builds them into three separate AssetBundles. Each AssetBundle uses around 500KB and only contains the sprite texture and associated metadata, with no dependencies.

譯:您有三個獨立組中的三個Addressable紋理,每個紋理構(gòu)建約為500KB。由于它們存在于不同的組中,Unity將它們構(gòu)建為三個獨立的AssetBundle。每個AssetBundle使用約500KB,僅包含精靈紋理和相關(guān)元數(shù)據(jù),沒有任何依賴項。

Example 2:

The three textures in Example 1 are put into a non-Addressable SpriteAtlas. In this case, Unity still generates three AssetBundles, but they are not the same size .One of the AssetBundles contains the atlas texture and uses about 1500KB. The other two AssetBundles only contain Sprite metadata and list the atlas AssetBundle as a dependency.

Although you can't control which AssetBundle contains the texture, the process is deterministic, so the same AssetBundle will contain the texture through different rebuilds. This is the main difference from the standard duplication of dependencies. The sprites are dependent on the SpriteAtlas texture to load, and yet that texture is not built into all three AssetBundles, but is instead built only into one.

譯:示例1中的三個紋理放入非Addressable SpriteAtlas中。在這種情況下,Unity仍會生成三個AssetBundle,但它們大小不同。其中一個AssetBundle包含Atlas紋理,使用約1500KB。另外兩個AssetBundle僅包含精靈元數(shù)據(jù),并將Atlas AssetBundle列為依賴項。

雖然您無法控制哪個AssetBundle包含紋理,但該過程具有確定性,因此同一AssetBundle將通過不同的重建包含紋理。這是與標準依賴項復(fù)制的主要區(qū)別。精靈依賴于SpriteAtlas紋理進行加載,但該紋理并未構(gòu)建到所有三個AssetBundle中,而是僅構(gòu)建到一個AssetBundle中。

Example 3:

This time, the SpriteAtlas from Example 2 is marked as Addressable in its own AssetBundle. Unity now creates four AssetBundles. If you use Unity version 2020.x or newer, this builds as you would expect. The three AssetBundles with the sprites are each only a few KB and have a dependency on the fourth AssetBundle, which contains the SpriteAtlas and is about 1500KB. If you are using 2019.4 or older, the texture itself may end up elsewhere. The three Sprite AssetBundles still depend on the SpriteAtlas AssetBundle. However, the SpriteAtlas AssetBundle may only contain metadata, and the texture may be in one of the other Sprite AssetBundles.

譯:現(xiàn)在,Example 2中的SpriteAtlas被標記為Addressable,并放在自己的AssetBundle中。Unity現(xiàn)在創(chuàng)建了四個AssetBundle。如果您使用的是Unity版本2020.x或更高版本,則構(gòu)建與您所期望的相同。具有sprites的三個AssetBundle每個僅為幾KB,并具有對第四個AssetBundle的依賴關(guān)系,該AssetBundle包含SpriteAtlas并且大小約為1500KB。如果您使用的是2019.4或更早版本,則紋理本身可能會在其他地方。三個Sprite AssetBundles仍依賴于SpriteAtlas AssetBundle。但是,SpriteAtlas AssetBundle可能僅包含元數(shù)據(jù),而紋理可能在其他Sprite AssetBundles之一中。

Addressable Prefabs With Sprite dependencies

Example 1:

You have three Addressable sprite prefabs - each prefab has a dependency on its own sprite (about 500KB). Building the three prefabs separately results in three AssetBundles of about 500KB each.

譯:您有三個Addressable sprite prefabs-每個prefab均依賴于自己的sprite(約為500KB)。分別構(gòu)建三個prefab將生成約500KB的三個AssetBundle。

Example 2:

The three textures from the previous example are added to a SpriteAtlas, and that atlas is not marked as Addressable. In this scenario, the SpriteAtlas texture is duplicated. All three AssetBundles are approximately 1500KB. This is expected based on the general rules about duplication of dependencies, but goes against the behavior seen in "Addressable Sprite Example 2".前面示例中的三個紋理添加到SpriteAtlas中,并且該Atlas未標記為Addressable。在這種情況下,SpriteAtlas紋理會被復(fù)制。三個AssetBundle大小均約為1500KB。根據(jù)依賴項復(fù)制的一般規(guī)則預(yù)期會出現(xiàn)此情況,但與“Addressable Sprite Example 2”中看到的行為相反。

譯:

Example 3:

The SpriteAtlas from the previous example is now also marked as Addressable. Conforming to the rules of explicit inclusion, the SpriteAtlas texture is included only in the AssetBundle containing the SpriteAtlas. The AssetBundles with prefabs reference this fourth AssetBundle as a dependency. This will lead to three AssetBundles of about 500KB and one of approximately 1500KB.

譯:前面示例中的SpriteAtlas現(xiàn)在也被標記為Addressable。符合顯式包含規(guī)則,SpriteAtlas紋理僅包含在包含SpriteAtlas的AssetBundle中。具有prefabs的AssetBundle將此第四個AssetBundle作為依賴項引用。這將導(dǎo)致三個約為500KB的AssetBundle和一個約為1500KB的AssetBundle。


Unity_Addressable_Addressables and SpriteAtlases(打包和圖集)的評論 (共 條)

分享到微博請遵守國家法律
龙胜| 孟村| 莱阳市| 简阳市| 县级市| 孟津县| 玉溪市| 渝中区| 襄汾县| 招远市| 柘城县| 依兰县| 社旗县| 营口市| 民乐县| 丰都县| 烟台市| 连平县| 天长市| 梁平县| 华阴市| 怀化市| 乌审旗| 田东县| 阿拉善左旗| 渝北区| 镇坪县| 潍坊市| 山东省| 海门市| 阳曲县| 万盛区| 崇左市| 黄陵县| 富裕县| 大连市| 兴山县| 都江堰市| 苏尼特左旗| 萨嘎县| 漯河市|