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
StudyUnityFromAnti-pattern
Search
Cova8bitdots
November 20, 2019
Programming
0
2.3k
StudyUnityFromAnti-pattern
Unity の使い方のアンチパターンを紹介。
そこからどう解消すべきかを紹介しています
Cova8bitdots
November 20, 2019
Tweet
Share
More Decks by Cova8bitdots
See All by Cova8bitdots
Latest_Information_of_CICD_for_UnityAppWithAppleVisionPro
cova8bitdots
0
21
HandGestureTool for AppleVisionPro
cova8bitdots
0
55
NinjaGazeTyping 制作秘話
cova8bitdots
0
260
UnityとGoogleCloudFunction を連携して社内サービスを作った話
cova8bitdots
0
120
Unity-chan.Terrastal!!
cova8bitdots
0
290
ExampleOfTilemap2D
cova8bitdots
0
83
unity_lt_2021_Dec.pdf
cova8bitdots
0
710
HowToUseAudioMixer
cova8bitdots
0
100
TrapOfSpriteAtlas
cova8bitdots
0
4.8k
Other Decks in Programming
See All in Programming
役立つログに取り組もう
irof
27
8.7k
のびしろを広げる巻き込まれ力:偶然を活かすキャリアの作り方/oso2024
takahashiikki
1
410
Golang と Erlang
taiyow
8
1.9k
Pinia Colada が実現するスマートな非同期処理
naokihaba
2
160
macOS でできる リアルタイム動画像処理
biacco42
7
1.9k
カラム追加で増えるActiveRecordのメモリサイズ イメージできますか?
asayamakk
4
1.6k
/←このスケジュール表に立ち向かう フロントエンド開発戦略 / A front-end development strategy to tackle a single-slash schedule.
nrslib
1
590
デプロイを任されたので、教わった通りにデプロイしたら障害になった件 ~俺のやらかしを越えてゆけ~
techouse
52
32k
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
16
4.1k
【Kaigi on Rails 2024】YOUTRUST スポンサーLT
krpk1900
1
250
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
480
生成 AI を活用した toitta 切片分類機能の裏側 / Inside toitta's AI-Based Factoid Clustering
pokutuna
0
580
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Designing for humans not robots
tammielis
249
25k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
41
2.1k
Git: the NoSQL Database
bkeepers
PRO
425
64k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
664
120k
Documentation Writing (for coders)
carmenintech
65
4.4k
Testing 201, or: Great Expectations
jmmastey
38
7k
BBQ
matthewcrist
85
9.3k
Transcript
Ξϯνύλʔϯ͔ΒֶͿ UNITYͷ͍ํ Gotanda.unity #14
Ξϯνύλʔϯྫ Public ม Prefab ͷ SerializeField Awake / Start
ิؒؔ Shader
Ξϯνύλʔϯྫ Public ม SerializeField / Prefab Awake / Start
ิؒؔ Shader
PUBLICม ▸ MonoBehaviour ܧঝΫϥεͰSerializeରʹͳΔ ▸ Unity Ͱ Serialize ରʹͳΔͨΊInspector͔Βฤू͕Մೳ
▸ উखʹฤूͤͨ͘͞ͳ͍࣌͋Δ ▸ ֎෦ʹΑΓ؆୯ʹॻ͖͑Մೳ ▸ ϓϩύςΟͰpublic ͳSetter Λఏڙ͍ͯ͠Δ߹ಉ༷ ▸ ΧϓηϧԽ(ใӅṭ)తʹඇৗʹϚζΠ جຊతʹ֎෦ΫϥεʹΑΔૢ࡞ةݥ
PUBLICม ղফ๏ ▸ MonoBehaviour ܧঝΫϥεͰSerializeରʹͳΔ ▸ [SerializeField] private / protected
ʹ͠·͠ΐ͏ ▸ Public มఆٛۃྗආ͚Δ ▸ SDKͱ͔ͰฏؾͰͬͯͨΓ͠·͢ΑͶ…(খ) ▸ ֎෦ʹΑΓ؆୯ʹॻ͖͑Մೳ ▸ Getter ͷެ։OK ▸ Setter ϝιουͰදݱ ▸ τϨʔαϏϦςΟͷ؍ΑΓ ϓϩύςΟΑΓϝιουͷํ͕Φεεϝ
PUBLICม PUBLICมͷར༻έʔε ▸ σʔλߏ (ΤϯςΟςΟ) ͷදݱ ▸ ग़དྷΕGetter/Setter ܦ༝͕·͍͕͠ ߹ʹΑͬͯެ։͠ͳ͚Ε͍͚ͳ͍͜ͱ͋Δ
▸ ΠϯλʔϑΣʔεܦ༝OK ▸ μϛʔίʔυ/αϯϓϧίʔυ࡞࣌ʹ༻͍Δ ▸ ग़དྷΕΘͳ͍ํ͕ྑ͍ ▸ αΫοͱઆ໌͢Δʹ͏͜ͱ͋Δ
Ξϯνύλʔϯྫ Public ม Prefab ͷ SerializeField Awake / Start
ิؒؔ Shader
PUBLICม ͜͜ʹଞऀʹґଘ͍ͯ͠ΔΦϒδΣΫτ͕͋Δ͡ΌΖ
PUBLICม ͜ΕΛPrefabԽͯ͠ಈతੜʹ͠Α͏ͱ͢Δͱ
PUBLICม ͜͏͡Όʂ
PUBLICม ▸ ԿͰ͔ΜͰࢀরΛInspector Ͱͷઃఆͯ͠͠·͏ ▸ ࣗͷPrefabҎ֎ͷཁૉ ▸ ґଘ͕ؔΊͪΌͪ͘Ό ▸
ॳظԽʹऑ͍ ▸ PrefabԽͨ͠ͱ͖ʹґଘ͕ണ͕ΕΔ ▸ ϖλϖλషΔཁૉ͕ଟ͍ͱΞλονҰۤ࿑
PUBLICม ղܾ๏ ▸ Inspector Ͱొ͖͢ͷ ▸ ࣗҎԼͷཁૉ ▸ ಈతੜ͢ΔPrefab ▸
ґଘੑͷղܾ ▸ ͪΌΜͱઃܭ͢Δʂ ▸ Ͳ͏ͯ͠ݫ͍͠߹Zenject ͳͲͷDI ίϯςφΛ༻͍Δ
Ξϯνύλʔϯྫ Public ม Prefab ͷ SerializeField Awake / Start
ิؒؔ Shader
AWAKE / START ▸ ͱΓ͋͑ͣॳظԽAwake/StartͰߦ͏ ▸ ֤ॴͰݺͼ͗ͯ͢Awake ͷ ࣮ߦॱʹґଘੑ͕ੜ͡Δ
▸ Θͳ͍Awake()/Start()/Update() ▸ ͕ଟ͍ͱݺͼग़͠ίετ͕ അࣛʹͳΒͳ͍(ಛʹUpdate)
AWAKE / START ▸ ґଘੑͷ͋ΔॳظԽ ▸ ॳظԽؔΛ༻ҙ͢Δ
▸ ॳظԽॲཧΛཧ͢Δ ͷղফ๏
AWAKE / START ▸ Θͳ͍Awake()/Start()/Update() ▸ ফ͢!! ͷղফ๏
Ξϯνύλʔϯྫ Public ม Prefab ͷ SerializeField Awake / Start
ิؒؔ ໊લۭؒ Shader
ิؒؔ ▸ Ґஔߋ৽Ͱ͜Μͳίʔυ͕ ▸ Lerp/Slerp ֶతʹʮʯΛܭࢉ͢Δؔ
▸ ͔֬ʹdeltaTime ͷׂ߹Ͱগͣͭ͠ඪʹۙͮ͘ ▸ ແݶ͔͚࣌ؒͳ͍ͱ࠷ऴʹͳΒͳ͍ ▸ ͦͦ0.033/0.016 ͣͭۙͮ͘ॲཧద͔ʁ ▸ ॲཧམͪͳͲ͢Δͱׂۙͮ͘߹ಈతʹมΘͬͯ͠·͏
ิؒؔ ▸ Lerp ͷ͍ํΛѲ͢Δ ▸ ͪΌΜͱυΩϡϝϯτΛಡΈ·͠ΐ͏ https://docs.unity3d.com/ja/current/ScriptReference/Vector3.Lerp.html ▸ ୈࡾҾΛ0.0~1.0
ʹมԽ͢Δίʔυʹ͢Δ ex) Coroutine Ͱͷ࣮ྫ ղܾ๏
Ξϯνύλʔϯྫ Public ม Prefab ͷ SerializeField Awake / Start
ิؒؔ Shader
SHADER ▸ ϐΫηϧγΣʔμʔͰॲཧͷॏ͍ؔΛ༻͍Δ ▸ ifจ ▸ ݅ذॏ͍ॲཧ ▸ ࡾ֯ؔ(
Sin,Cos,Tan ) ▸ ܭࢉࣗମ͕ॏ͍ ▸ Log, Sqrt ͳͲ
SHADER ▸ ϐΫηϧγΣʔμʔͰͷॲཧͷॏ͍ؔ ▸ ifจ ▸ ܰྔͳֶؔͰΘΓͷදݱ ex) ceil(clamp(_value,
0, 1)) _value ͕ෛ:0, ਖ਼:1 uvͰv ͕0.5 Ҏ্͔Ͳ͏͔ˠ ceil(clamp(i.uv.y - 0.5, 0, 1)) ▸ ࡾ֯ؔ( Sin,Cos,Tan ) ▸ ࡾ֯ؔςʔϒϧΛ࡞/ςΫενϟʹॻ͖ࠐΜͰ͓͘ ▸ r=Sin, g=Cos, b = Tan ▸ Log, Sqrt ͳͲ ▸ ۃྗΘͳ͍ ▸ Sqrt ͷΘΓʹೋͰൺֱͳͲ ղফ๏
࠷ޙʹ ▸ υΩϡϝϯτͪΌΜͱಡΈ·͠ΐ͏ ▸ Θ͔Βͳ͍͚ͲͬͯΈͨNG ▸ ઃܭΛͪΌΜͱߟ͑·͠ΐ͏ ▸ ಛʹӡ༻ίϯςϯπͳͲޙʑͰͬ͠ฦ͕͖͠·͢ ▸
ٕज़తෛ࠴ͱ͖߹͍·͠ΐ͏ ▸ ύϑΥʔϚϯεΛؾʹ͠·͠ΐ͏ ▸ ৭ʑݕূهࣄͳͲΛ୳ͯ͠Έ·͠ΐ͏ ▸ ͳ͚ΕࣗͰܭଌͯ͠Έ·͠ΐ͏ ▸ ग़དྷΕͦͷ݁ՌΛγΣΞͯ͠Β͑Δͱ ΈΜͳ͕ͤʹͳΓ·͢ ·ͱΊ