SlideShare una empresa de Scribd logo
1 de 52
Descargar para leer sin conexión
知って得する

Unity

株式会社ハ・ン・ド
プログラマ
馬場翔太
http://baba-s.hatenablog.com/
スライド内容
1. エディタの操作について
2. エディタの拡張について
3. アセットの活用について
エディタの操作
private変数の状態を確認したい

public class Character : MonoBehaviour
{
private int id = 1;
private string name = "Mike";
}
private変数をInspectorに表示する
Inspectorの右上のボタンからDebugを選択

http://terasur.blog.fc2.com/blog-entry-252.html
エディタ停止を忘れて作業をしてしまった
エディタ再生時の色を変える
1. 「Unity>Preference...」を選択する
2. 「Colors>Genreal>Playmode tint]の色を変更する

http://terasur.blog.fc2.com/blog-entry-252.html
ログを出力したオブジェクトを特定したい

private void Start()
{
Debug.Log("Start");
}
ログを出力したオブジェクトを選択
第二引数にオブジェクトやコンポーネントを渡す
private void Start()
{
Debug.Log("Start", this);
}
オブジェクトをキレイに配置したい
オブジェクトの移動や回転でスナップ
Ctrlキーを押しながら移動や回転をさせるとスナップ可能
スナップする量は「Edit>Snap Settings...」で設定可能
深い親子階層を一気に開きたい
Altキーを押しながらアイテムの親子関係を開く
Projectビューで特定のアセットのみ表示
検索欄の右のボタンで表示したいアセットの種類を選択
オブジェクトやアセットを複製したい
複製したいアイテムを選択してCtrl+D
(アセットなら連番の適用も可能)
エディタの拡張
アセットの設定変更を効率化したい
• テクスチャの種類をGUIに
• AudioClipの3Dサウンドをオフに
アセットインポート時に設定を自動変更
using UnityEditor;
public class AssetPreprocessor : AssetPostprocessor
{
private void OnPreprocessTexture()
{
var importer = assetImporter as TextureImporter;
importer.textureType = TextureImporterType.GUI;
}
private void OnPreprocessAudio()
{
var importer = assetImporter as AudioImporter;
importer.threeD = false;
}
}
http://www.buildinsider.net/consumer/charmofunity/01
http://kan-kikuchi.hatenablog.com/entry/2013/11/25/000144
アセットインポート時に設定を自動変更
AssetPostprocessorクラス
継承してクラスを記述することで

アセット読み込み時の独自の処理を実装できます

using UnityEditor;
public class AssetPreprocessor : AssetPostprocessor
{
}
http://www.buildinsider.net/consumer/charmofunity/01
http://kan-kikuchi.hatenablog.com/entry/2013/11/25/000144
アセットインポート時に設定を自動変更
OnPreprocessTexture関数
テクスチャがインポートされた時に呼び出されます

private void OnPreprocessTexture()
{
var importer = assetImporter as TextureImporter;
importer.textureType = TextureImporterType.GUI;
}

http://www.buildinsider.net/consumer/charmofunity/01
http://kan-kikuchi.hatenablog.com/entry/2013/11/25/000144
アセットインポート時に設定を自動変更
OnPreprocessAudio関数
AudioClipがインポートされた時に呼び出されます

private void OnPreprocessAudio()
{
var importer = assetImporter as AudioImporter;
importer.threeD = false;
}

http://www.buildinsider.net/consumer/charmofunity/01
http://kan-kikuchi.hatenablog.com/entry/2013/11/25/000144
再生中にスクリプトを編集してエラーに
再生中にスクリプトを編集して保存すると
コンパイル後にエラーが出力される
スクリプト編集後に実行を自動で停止
[InitializeOnLoad]
public static class PlaymodeStop
{
static PlaymodeStop()
{
EditorApplication.update += Update;
}
private static void Update()
{
if ( EditorApplication.isCompiling &&
EditorApplication.isPlaying)
{
EditorApplication.isPlaying = false;
}
}
}
http://masa795.hatenablog.jp/entry/2013/05/10/104033
スクリプト編集後に実行を自動で停止
InitializeOnLoad属性
staticコンストラクタを持つクラスに記述すると

エディタ起動時に独自のスクリプトを実行できる

[InitializeOnLoad]
public static class PlaymodeStop
{
static PlaymodeStop()
{
}
}

http://masa795.hatenablog.jp/entry/2013/05/10/104033
スクリプト編集後に実行を自動で停止
EditorApplication.update
エディタで再生中に毎秒約100回呼ばれるコールバック

static PlaymodeStop()
{
EditorApplication.update += Update;
}

http://masa795.hatenablog.jp/entry/2013/05/10/104033
スクリプト編集後に実行を自動で停止
EditorApplicationクラス
スクリプトがコンパイルされたかどうかや

エディタが再生中かどうかを確認できるクラス
private static void Update()
{
if ( EditorApplication.isCompiling &&
EditorApplication.isPlaying)
{
EditorApplication.isPlaying = false;
}
}
http://masa795.hatenablog.jp/entry/2013/05/10/104033
アセットの活用
手順を効率化したい
• Project Settingsの設定
• ゲームオブジェクトの作成
ショートカットを追加する
Extras Toolbar(無料)

http://masa795.hatenablog.jp/entry/2013/06/14/094537
ショートカットを追加する
「Window>Extras」を選択

http://masa795.hatenablog.jp/entry/2013/06/14/094537
配列をコンソールログに出力したい

// 標準のコンソール出力
var array = new []{ "1", "2", "3", “4", “5", };
Debug.Log(array);
配列をコンソールログに出力する
Quick Debugger(無料)

http://terasur.blog.fc2.com/blog-entry-211.html
配列をコンソールログに出力する
// Quick Debuggerのコンソール出力
var array = new []{ "1", "2", "3", “4", “5", };
Debugger.Array<string>(array);

http://terasur.blog.fc2.com/blog-entry-211.html
配列をコンソールログに出力する
二次元配列やコレクションも出力可能
// 二次元配列
Debugger.Array2D<string>(array);
// List型
Debugger.List<string>(list);
// Dictionary型
Debugger.Dictionary<int, string>(dict);
http://terasur.blog.fc2.com/blog-entry-211.html
オブジェクトのパラメータを間違って変更
GameObjectをロック
UnityLock(無料)

http://terasur.blog.fc2.com/blog-entry-487.html
GameObjectをロック
1. ロックしたいオブジェクトを選択
2. 「GameObject>UnityLock>Lock GameObject」を選択

http://terasur.blog.fc2.com/blog-entry-487.html
アプリサイズのボトルネックを見つけたい
テクスチャ

AudioClip

モデル
アプリサイズの内訳を確認
Build Report Tool($5)

http://terasur.blog.fc2.com/blog-entry-472.html
http://plaza.rakuten.co.jp/coronasdk/diary/201305230001/
アプリサイズを確認
使用しているアセットの容量を確認
使用していないアセットの確認と削除
簡単に動きをつける
iTween(無料)

http://www40.atwiki.jp/spellbound/pages/1604.html
エディタ上でiTweenを設定する
iTween Visual Editor(無料)

http://www.cho-design-lab.com/2013/08/07/unity-itween-visual-editor-introduction
アプリの解読や改ざんを防ぐ
CodeGuard($40)

http://masa795.hatenablog.jp/entry/2013/06/29/131336
フォトショのデータをNGUIにインポート
FastGUI for NGUI($20)

http://terasur.blog.fc2.com/blog-entry-337.html
エディタ再生中に変更した値を保持する
PlayModePersist($20)

http://terasur.blog.fc2.com/blog-entry-578.html
ドローコールを減らす
Draw Call Minimizer(無料)

http://terasur.blog.fc2.com/blog-entry-214.html
オススメのパーティクルシステム
"Shuriken Magic" Effect Pack($35)

http://memo.scri.me/entry/2013/02/09/002415
オススメの3Dモデル
First Fantasy for Mobile($20)
オススメの3Dモデル
Low Poly Fantasy Village Pack.01($20)
オススメの3Dモデル
Palace of Orinthalian(無料)
ありがとうございました

Más contenido relacionado

Último

Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Hiroshi Tomioka
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)Hiroshi Tomioka
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Gamesatsushi061452
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NTT DATA Technology & Innovation
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイスCRI Japan, Inc.
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...Toru Tamaki
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルCRI Japan, Inc.
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video UnderstandingToru Tamaki
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 

Último (11)

Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 

Destacado

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Destacado (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

知って得するUnity