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
24
HandGestureTool for AppleVisionPro
cova8bitdots
0
64
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
TrapOfSpriteAtlas
cova8bitdots
0
4.9k
Other Decks in Programming
See All in Programming
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
340
Contemporary Test Cases
maaretp
0
140
Realtime API 入門
riofujimon
0
150
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.7k
C++でシェーダを書く
fadis
6
4.1k
Arm移行タイムアタック
qnighy
0
330
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
970
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Featured
See All Featured
Ruby is Unlike a Banana
tanoku
97
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Site-Speed That Sticks
csswizardry
0
28
GraphQLとの向き合い方2022年版
quramy
43
13k
Unsuck your backbone
ammeep
668
57k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Rails Girls Zürich Keynote
gr2m
94
13k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
Being A Developer After 40
akosma
87
590k
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 ▸ ઃܭΛͪΌΜͱߟ͑·͠ΐ͏ ▸ ಛʹӡ༻ίϯςϯπͳͲޙʑͰͬ͠ฦ͕͖͠·͢ ▸
ٕज़తෛ࠴ͱ͖߹͍·͠ΐ͏ ▸ ύϑΥʔϚϯεΛؾʹ͠·͠ΐ͏ ▸ ৭ʑݕূهࣄͳͲΛ୳ͯ͠Έ·͠ΐ͏ ▸ ͳ͚ΕࣗͰܭଌͯ͠Έ·͠ΐ͏ ▸ ग़དྷΕͦͷ݁ՌΛγΣΞͯ͠Β͑Δͱ ΈΜͳ͕ͤʹͳΓ·͢ ·ͱΊ