タグ/レイヤー
公式サイト:
目次
- 1 レイヤー
- 2 タグあるいはレイヤーに該当するオブジェクトを選択する
- 3 タグ付けされたオブジェクトを見つける
- 4 レイヤーマスク (LayerMask)
- 5 RayCast でレイヤーを使う
- 6 レイヤーの判定
- 7 レイヤーを enum として扱う
- 8 タグの代わりに enum を用いる
- 9 LayerToName / NameToLayer / GetMask
- 10 タグをドロップダウンリストで指定する
- 11 EditorOnly
- 12 Tags and Layers Enums Builder
- 13 Find With Tag Editor
- 14 More Tags
- 15 Find Scene Objects With Tag
- 16 Tags Filters
レイヤー
参考:
タグあるいはレイヤーに該当するオブジェクトを選択する
参考:
Filtering Hierarchy by Tag or Layer | nevzatarman
How to search gameobject in scene by tag name – Unity Answers
How to search by tag in hierarchy? – Unity Answers
タグ付けされたオブジェクトを見つける
参考:
Tag を使用した高速なオブジェクトの参照方法 FindWithTag | すくまりのメモ帳
Find 関数の使い分け オブジェクトを見つける時 | 徒然エンジニアブログ
Unity でタグのついたオブジェクトをまとめて操作する方法 | TECH Projin
GameObject.FindWithTag | Unity スクリプトリファレンス [公式]
GameObject.FindGameObjectsWithTag | Unity スクリプトリファレンス [公式]
レイヤーマスク (LayerMask)
参考:
UnityEngine.LayerMask | Unity スクリプトリファレンス [公式]
Why do Unity layer masks need to use bit shifting? – Game Development Stack Exchange
RayCast でレイヤーを使う
参考:
レイヤーの判定
参考:
LayerMask の中に対象の Layer が含まれているかチェックする方法 – Qiita
レイヤーを enum として扱う
参考:
Unity の Layer を Enum にしてくれる Editor 拡張を作った – Qiita
Global Enum for Tags and Layers – Unity Forum
タグの代わりに enum を用いる
参考:
enum で Tag のように管理するスクリプトを作成する – Qiita
LayerToName / NameToLayer / GetMask
LayerToName
:レイヤー番号からレイヤー名を取得する。NameToLayer
:レイヤー名からレイヤー番号を取得する。GetMask
:レイヤー名を与えてレイヤーマスクを作成する。任意の数のレイヤーを指定できる。
参考:
LayerMask.LayerToName | Unity スクリプトリファレンス [公式]
LayerMask.NameToLayer | Unity スクリプトリファレンス [公式]
LayerMask.GetMask | Unity スクリプトリファレンス [公式]
タグをドロップダウンリストで指定する
参考:
Tag mask dropdown like Layer mask – Unity Answers
EditorOnly
参考:
ゲームオブジェクトに EditorOnly タグを設定してビルドに含まれないようにする | コガネブログ
Tags and Layers Enums Builder
コード:
Tags and Layers Enums Builder for Unity (Namek) – GitHub Gist
Find With Tag Editor
入手:
Find With Tag Editor | Unity Asset Store [Official]
参考:
Find With Tag Editor – エディタ上でタグで GameObject を検索できる | ゲームつくろうぜ
More Tags
入手:
More Tags | Unity Asset Store [Official]
参考:
More Tags – Add Multi Tags to GameObject | Unity Forum
Find Scene Objects With Tag
コード:
Find Scene Objects With Tag | Unify Community Wiki
参考:
タグでシーン内のゲームオブジェクトを検索するエディタ拡張 – Qiita
Find Scene Objects With Tag – シーン内のゲームオブジェクトをタグ検索するエディタ拡張 – Qiita
Tags Filters
**UNMAINTAINED**
リポジトリ:
PixeyeHQ/Unity3d-Tags-Filters: Extending a Unity Inspector Window to Show int Tags – GitHub