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
26
HandGestureTool for AppleVisionPro
cova8bitdots
0
69
NinjaGazeTyping 制作秘話
cova8bitdots
0
270
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
130
Unity-chan.Terrastal!!
cova8bitdots
0
300
ExampleOfTilemap2D
cova8bitdots
0
87
unity_lt_2021_Dec.pdf
cova8bitdots
0
730
HowToUseAudioMixer
cova8bitdots
0
110
StudyUnityFromAnti-pattern
cova8bitdots
0
2.3k
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
120
似たもの同士のPerlとPHP
uzulla
1
110
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
4
700
The rollercoaster of releasing an Android, iOS, and macOS app with Kotlin Multiplatform | droidcon Italy
prof18
0
150
macOS なしで iOS アプリを開発する(※ただし xxx に限る)
mitsuharu
1
170
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
210
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
650
Cognitoが大型アップデート!Managed Loginとパスワードレスログインを実際に使ってみた@しむそくRadio Special Day1
tmhirai
3
280
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
980
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
730
Djangoの開発環境で工夫したこと - pre-commit / DevContainer
hiroki_yod
1
700
たのしいparse.y
ydah
3
120
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Code Reviewing Like a Champion
maltzj
520
39k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
A Philosophy of Restraint
colly
203
16k
How to train your dragon (web standard)
notwaldorf
88
5.7k
RailsConf 2023
tenderlove
29
920
Git: the NoSQL Database
bkeepers
PRO
427
64k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.8k
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 Ͱͷར༻Մೳ ɾམͱ݀͠ʹҾ͔͔ͬΔͱ࠷ѱϏϧυ͢Βग़དྷͳ͘ͳΔ ɾ༻๏ɺ༻ྔਖ਼͍͘͠·͠ΐ͏