Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
TrapOfSpriteAtlas
Search
Cova8bitdots
December 07, 2019
Programming
0
4.9k
TrapOfSpriteAtlas
SpriteAtlas の利用上の注意点をまとめました
Cova8bitdots
December 07, 2019
Tweet
Share
More Decks by Cova8bitdots
See All by Cova8bitdots
Latest_Information_of_CICD_for_UnityAppWithAppleVisionPro
cova8bitdots
0
24
HandGestureTool for AppleVisionPro
cova8bitdots
0
62
NinjaGazeTyping 制作秘話
cova8bitdots
0
260
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
120
Unity-chan.Terrastal!!
cova8bitdots
0
290
ExampleOfTilemap2D
cova8bitdots
0
84
unity_lt_2021_Dec.pdf
cova8bitdots
0
720
HowToUseAudioMixer
cova8bitdots
0
110
StudyUnityFromAnti-pattern
cova8bitdots
0
2.3k
Other Decks in Programming
See All in Programming
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
770
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
4
2.1k
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
430
開発効率向上のためのリファクタリングの一歩目の選択肢 ~コード分割~ / JJUG CCC 2024 Fall
ryounasso
0
440
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
160
CSC509 Lecture 11
javiergs
PRO
0
180
Ethereum_.pdf
nekomatu
0
420
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
1
350
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
210
推し活の ハイトラフィックに立ち向かう Railsとアーキテクチャ - Kaigi on Rails 2024
falcon8823
6
2.8k
ペアーズにおけるAmazon Bedrockを⽤いた障害対応⽀援 ⽣成AIツールの導⼊事例 @ 20241115配信AWSウェビナー登壇
fukubaka0825
5
1.5k
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
600
Featured
See All Featured
Designing for Performance
lara
604
68k
For a Future-Friendly Web
brad_frost
175
9.4k
Agile that works and the tools we love
rasmusluckow
327
21k
Unsuck your backbone
ammeep
668
57k
Measuring & Analyzing Core Web Vitals
bluesmoon
3
78
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
A Tale of Four Properties
chriscoyier
156
23k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.8k
What's in a price? How to price your products and services
michaelherold
243
12k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Transcript
Unity ͓ɾͱɾͳͷLTେձ 2019 SpriteAtlasͷམͱ݀͠
·͓ͣ͞Β͍ ATLASͬͯͳΜ͚ͩͬʁ ɾAtlas(ਤா) ɹෳը૾ΛύοΫͯ͠Ұͭͷը૾ʹͨ͠ͷ
·͓ͣ͞Β͍ UNITY ʹ͓͚ΔATLAS ɾUnity2017 ͔ΒSpriteAtlas͕ಋೖ͞Εͨ ɹ(SpritePacker ͳΜͯແ͔ͬͨɻ͍͍Ͷʁ) ɾNGUI, TexturePacker ͷ֎෦Ξηοτʹ
ɹཔΒͳͯ͘ྑ͘ͳͬͨ
མͱ݀͠ ࣮ࡍʹͬͯΈͯ (ͬͺΓ) མͱ͕݀͋ͬͨ͠ 1. SpriteAtlasManager ͷΠϕϯτొλΠϛϯά 2. SpriteAtlasͷReleaseλΠϛϯά 3.
Profiler ͷදࣔใ 4. ੩తͳUIͰͷར༻ํ๏ 5. ςΫενϟαΠζ͕ഒ
མͱ݀͠Ϧετ 1. SpriteAtlasManager ͷΠϕϯτొλΠϛϯά 2. SpriteAtlasͷReleaseλΠϛϯά 3. Profiler ͷදࣔใ 4.
੩తͳUIͰͷར༻ํ๏ 5. ςΫενϟαΠζ͕ഒ
SPRITEATLASMANAGER ͷΠϕϯτొλΠϛϯά AwakeͰίʔϧόοΫΛొ 1. ىಈSceneͰSpriteAtlasΛ༻͍Δ 2. Scene ϩʔυ࣌ʹSpriteAtlasManager. atlasRequested͕ݺΕΔ 3.
Awake ͕Δ SpriteAtlasͷϩʔυॲཧ͕Βͳ͍
SPRITEATLASMANAGER ͷΠϕϯτొλΠϛϯά ղܾํ๏ 1. ͦͦBootSceneͱ͔ʹUIΛஔ͔ͳ͍ 2. BootSceneͷલʹPreBootSceneతͳͷΛ༻ҙ 3. [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] ଐੑΛ͚ͭͨϝιουΛ༻ҙͯͦ͜͠ͰίʔϧόοΫΛొ
ͨͩ͠ɺ্هଐੑΛ͚ͭͯϝιουSceneʹ͋Δͳ͍ؔΘΒͣ ίʔϧ͞ΕΔͷͰҙ
མͱ݀͠Ϧετ 1. SpriteAtlasManager ͷΠϕϯτొλΠϛϯά 2. SpriteAtlasͷReleaseλΠϛϯά 3. Profiler ͷදࣔใ 4.
੩తͳUIͰͷར༻ํ๏ 5. ςΫενϟαΠζ͕ഒ
SPRITEATLASͷRELEASEλΠϛϯά ‣ ͋ΔSpriteAtlas ͷඞཁλΠϛϯάSpriteAtlasManager.atlasRequested ͰΘ͔Δ ‣ ͋ΔSpriteAtlas͕ෆཁʹͳΔλΠϛϯάෆ໌ ‣ ΞϓϦʹؚΉϦιʔεͷ߹ Resources.UnloadUnsedAssetsͰղ์Մೳ
‣ AssetBundle, Addressables ͷ߹…
SPRITEATLASͷRELEASEλΠϛϯά ‣ AssetBundle, Addressablesͷ߹ࣗલͰϦιʔεղ์Λ͠ͳ͍ͱNG 1. AtlasొλΠϛϯάͰࣗલͰཧ 2. SceneΓସ͑࣌ʹUnloadΛݺͿ
མͱ݀͠Ϧετ 1. SpriteAtlasManager ͷΠϕϯτొλΠϛϯά 2. SpriteAtlasͷReleaseλΠϛϯά 3. Profiler ͷදࣔใ 4.
੩తͳUIͰͷར༻ํ๏ 5. ςΫενϟαΠζ͕ഒ
PROFILER ͷදࣔใ Α͠ProfilerͰϝϞϦঢ়گݟͯΈΔ͔
PROFILER ͷදࣔใ ͑ʁ॥ࢀরͯ͠ΔΜ͚ͩͲʁ
PROFILER ͷදࣔใ ͔ͬͯΦϒδΣΫτશ෦Destroyͯ͠ UnloadUnusedAssetݺΜͰͬͯΔ
PROFILER ͷදࣔใ ެࣜʹ͍߹Θͤͨ ʻ͜Εόάʁ ҙਤతͰʼ https://docs.unity3d.com/Manual/ProfilerMemory.html ϚχϡΞϧʹ࣮ػͱEditor ҧ͏ͬͯॻ͍ͯΔͬ͠ΐʁ ͏ΜɻΘ͔ͬͨɻ (
… ͍͜Εͯ͠Α)
PROFILER ͷදࣔใ ิɿ ࣮ػͰResourcesݺͼग़͠ͷ߹ UnloadUnsedAssetͰͪΌΜͱϝϞϦ͔Βফ͑Δ༷ ͋͘·ͰEditor࠶ੜ࣌ͷڍಈͷ
མͱ݀͠Ϧετ 1. SpriteAtlasManager ͷΠϕϯτొλΠϛϯά 2. SpriteAtlasͷReleaseλΠϛϯά 3. Profiler ͷදࣔใ 4.
੩తͳUIͰͷར༻ํ๏ 5. ςΫενϟαΠζ͕ഒ
੩తͳUIͰͷར༻ํ๏ AtlasΛηοτͯ͠NGUIͱ͔Έ͍ͨʹ Popup ͰSpriteΛબͼ͍ͨͳ͊ AtlasΛઃఆͰ͖ΔImageΛ֦ுͨ͠ ಠࣗΫϥε࡞ͬͯEditor֦ு͢Δ͔ (Clone) ͍ͬͯͭͯΔ͚ͲઃఆͰ͖ͨΘ
੩తͳUIͰͷར༻ํ๏ UnityΛ࠶ىಈͯ͠ΈΔ ͳΜ͔Ͱͨ Ϗϧυͯ͠ΈΔ Unity2017: ϏϧυΤϥʔ+SceneͷอଘෆՄ Unity2019: Ϗϧυ௨Δ͕SceneͷอଘෆՄ
੩తͳUIͰͷར༻ํ๏ ͍ͦͦํ͕ҧ͏!! SpriteAtlasͷڍಈ 1. ίϯϙʔωϯτʹAtlasΛઃఆ͠ͳͯྑ͍ 2. ैདྷ௨ΓImageʹAtlasʹొͨ͠SpriteຊମΛී௨ʹઃఆͯ͠OK 3. Play࣌/Build࣌ʹ2. ͷSprite͕SpriteAtlasͷࢀরʹஔ͖ΘΔ
Atlas Λొ͖࣌͢ɿ ϥϯλΠϜͰAtlasΛࢀরͯ͠ಈతʹΓସ͍͑ͨ߹
མͱ݀͠Ϧετ 1. SpriteAtlasManager ͷΠϕϯτొλΠϛϯά 2. SpriteAtlasͷReleaseλΠϛϯά 3. Profiler ͷදࣔใ 4.
੩తͳUIͰͷར༻ํ๏ 5. ςΫενϟαΠζ͕ഒ
ςΫενϟαΠζ͕ഒ SpriteAtlas ͱొͨ͠ςΫενϟΛResourcesҎԼʹஔ͍ͨ ྆ํͱΞϓϦʹؚ·ΕͯςΫενϟαΠζ͕ഒ
ςΫενϟαΠζ͕ഒ ॴΛ͚ͯͪΌΜͱཧ͠Α͏ AssetBundle Addressables͚͓ͯ͘ ※Include in Build ͷνΣοΫ֎͢͜ͱ ΞϓϦʹؚΉAtlasResourcesҎԼʹ Atlasʹొ͢Δը૾
Resouces ҎԼʹஔ͔ͳ͍!!
࠷ޙʹ ·ͱΊ ɾམͱ݀͠Λཧղ͢ΕۀͰར༻Մೳ ɹɾAssetBundle/Addressables Ͱͷར༻Մೳ ɾམͱ݀͠ʹҾ͔͔ͬΔͱ࠷ѱϏϧυ͢Βग़དྷͳ͘ͳΔ ɾ༻๏ɺ༻ྔਖ਼͍͘͠·͠ΐ͏