SlideShare a Scribd company logo
1 of 52
Download to read offline
知って得する

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(無料)
ありがとうございました

More Related Content

Recently uploaded

SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 

Recently uploaded (9)

SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 

Featured

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
 

Featured (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