Version: 2017.3

GridBrush

class in UnityEditor

/

継承:GridBrushBase

マニュアルに切り替える

説明

Default built-in brush for painting or erasing tiles and/or gamobjects on a grid.

Default brush is meant for two things: Authoring GameObjects on a grid and authoring tiles on a grid. It can be used for both at the same time if necessary. Basically the default brush allows you to pick and paste tiles and GameObjects from one area to another.

Tiles in a tilemap are considered to be active for brush editing if a GameObject with Tilemap is currently selected. GameObjects are considered to be active for brush editing if their parent GameObject is currently selected.

For example: A new default brush with size of 2x3 is generated as a result of scene view picking operation. The new instance contains six cells (BrushCell) and the cells are fed with tiles & GameObjects from the picking area.

Later when this brush is used in a painting operation, all the tiles and GameObjects contained in the cells are set/cloned into a new scene position.

When creating custom brushes, it is recommended to inherit GridBrushBase by default. Inheriting GridBrush is possible when similar functionality is required, but extending it has its limits compared to base class.

It is also possible to replace the default GridBrush from the Tile Palette brush list completely by using the GridDefaultBrush attribute on one of your custom brushes and promote it to become a new default brush of the project. This is useful when higher level brush can operate as a default and protect designers from accidentally using the built-in one.

変数

cellCountNumber of brush cells in the brush.
cellsAll the brush cells the brush holds.
pivotPivot of the brush.
sizeSize of the brush in cells.

Public 関数

BoxEraseErases tiles and GameObjects from given bounds within the selected layers.
BoxFillBox fills tiles and GameObjects into given bounds within the selected layers.
EraseErases tiles and GameObjects in a given position within the selected layers.
FlipFlips the brush in the given axis.
FloodFillFlood fills tiles and GameObjects starting from a given position within the selected layers.
GetCellIndexGets the index to the GridBrush.BrushCell based on the position of the BrushCell.
GetCellIndexWrapAroundGets the index to the GridBrush.BrushCell based on the position of the BrushCell. Wraps each coordinate if it is larger than the size of the GridBrush.
InitInitializes the content of the GridBrush.
MoveEndMoveEnd is called when user has ended the move of the area previously selected with the selection marquee.
MoveStartMoveEnd is called when user starts moving the area previously selected with the selection marquee.
PaintPaints tiles and GameObjects into a given position within the selected layers.
PickPicks tiles from selected tile maps and child GameObjects, given the coordinates of the cells.
ResetClear all data of the brush.
RotateRotates the brush by 90 degrees in the given direction.
SetColorSets a tint color at the position in the brush.
SetMatrixSets a transform matrix at the position in the brush. This matrix is used specifically for tiles on a Tilemap and not GameObjects of the brush cell.
SetTileSets a Tile at the position in the brush.
UpdateSizeAndPivotUpdates the size, pivot and the number of layers of the brush.

継承メンバー

変数

hideFlagsオブジェクトは非表示、シーンに保存、ユーザーが編集可能、などを設定する。
nameオブジェクト名

Public 関数

MoveMove is called when user moves the area previously selected with the selection marquee.
SelectSelect an area of a grid.
GetInstanceIDオブジェクトのインスタンス ID を返します
ToStringReturns the name of the GameObject.

Static 関数

Destroyゲームオブジェクトやコンポーネント、アセットを削除します
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoad新しいシーンを読み込んでもオブジェクトが自動で破壊されないように設定します
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsOfTypeタイプから見つけたすべてのアクティブのオブジェクト配列を返します
Instantiateoriginal のオブジェクトをクローンします
CreateInstanceScriptableObject のインスタンスを作成します。

Operator

boolオブジェクトが存在するかどうか
operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。

メッセージ

Awake ScriptableObject スクリプトを開始するとき、この関数は呼び出されます。
OnDestroyScriptableObject が破棄されるとき、この関数は呼び出されます。
OnDisableScriptableObject クラスのオブジェクトがスコープを外れるとき、この関数は呼び出されます。
OnEnableオブジェクトがロードされたとき、この関数は呼び出されます。
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961