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
28
HandGestureTool for AppleVisionPro
cova8bitdots
0
71
NinjaGazeTyping 制作秘話
cova8bitdots
0
270
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
130
Unity-chan.Terrastal!!
cova8bitdots
0
310
ExampleOfTilemap2D
cova8bitdots
0
89
unity_lt_2021_Dec.pdf
cova8bitdots
0
740
HowToUseAudioMixer
cova8bitdots
0
110
StudyUnityFromAnti-pattern
cova8bitdots
0
2.3k
Other Decks in Programming
See All in Programming
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
Exploring: Partial and Independent Composables
blackbracken
0
100
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
2
100
ドメインイベント増えすぎ問題
h0r15h0
2
350
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
220
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
210
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
820
testcontainers のススメ
sgash708
1
120
php-conference-japan-2024
tasuku43
0
320
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
450
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Documentation Writing (for coders)
carmenintech
66
4.5k
Building Applications with DynamoDB
mza
91
6.1k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
A Philosophy of Restraint
colly
203
16k
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 Ͱͷར༻Մೳ ɾམͱ݀͠ʹҾ͔͔ͬΔͱ࠷ѱϏϧυ͢Βग़དྷͳ͘ͳΔ ɾ༻๏ɺ༻ྔਖ਼͍͘͠·͠ΐ͏