Class RuleOverrideTile
Rule Override Tiles are Tiles which can override a subset of Rules for a given Rule Tile to provide specialised behaviour while keeping most of the Rules originally set in the Rule Tile.
Inherited Members
Namespace: UnityEngine.Tilemaps
Assembly: Unity.2D.Tilemap.Extras.dll
Syntax
[MovedFrom(true, "UnityEngine", null, null)]
[Serializable]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.2d.tilemap.extras@latest/index.html?subfolder=/manual/RuleOverrideTile.html")]
public class RuleOverrideTile : TileBase
Fields
m_GameObjects
A list of GameObject Overrides
Declaration
public List<RuleOverrideTile.TileGameObjectPair> m_GameObjects
Field Value
| Type | Description |
|---|---|
| List<RuleOverrideTile.TileGameObjectPair> |
m_InstanceTile
Returns the Rule Tile for retrieving TileData
Declaration
[HideInInspector]
public RuleTile m_InstanceTile
Field Value
| Type | Description |
|---|---|
| RuleTile |
m_Sprites
A list of Sprite Overrides
Declaration
public List<RuleOverrideTile.TileSpritePair> m_Sprites
Field Value
| Type | Description |
|---|---|
| List<RuleOverrideTile.TileSpritePair> |
m_Tile
The RuleTile to override
Declaration
public RuleTile m_Tile
Field Value
| Type | Description |
|---|---|
| RuleTile |
Properties
this[GameObject]
Gets the overriding GameObject of a given GameObject.
Declaration
public GameObject this[GameObject originalGameObject] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | originalGameObject | The original GameObject that is overridden |
Property Value
| Type | Description |
|---|---|
| GameObject |
this[Sprite]
Gets the overriding Sprite of a given Sprite.
Declaration
public Sprite this[Sprite originalSprite] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Sprite | originalSprite | The original Sprite that is overridden |
Property Value
| Type | Description |
|---|---|
| Sprite |
Methods
ApplyOverrides(IList<KeyValuePair<GameObject, GameObject>>)
Applies overrides to this
Declaration
public void ApplyOverrides(IList<KeyValuePair<GameObject, GameObject>> overrides)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<KeyValuePair<GameObject, GameObject>> | overrides | A list of overrides to apply |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The input overrides list is not valid |
ApplyOverrides(IList<KeyValuePair<Sprite, Sprite>>)
Applies overrides to this
Declaration
public void ApplyOverrides(IList<KeyValuePair<Sprite, Sprite>> overrides)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<KeyValuePair<Sprite, Sprite>> | overrides | A list of overrides to apply |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The input overrides list is not valid |
GetOverrides(List<KeyValuePair<GameObject, GameObject>>, ref int)
Gets overrides for this
Declaration
public void GetOverrides(List<KeyValuePair<GameObject, GameObject>> overrides, ref int validCount)
Parameters
| Type | Name | Description |
|---|---|---|
| List<KeyValuePair<GameObject, GameObject>> | overrides | A list of overrides to fill |
| int | validCount | Returns the number of valid overrides for GameObjects |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The input overrides list is not valid |
GetOverrides(List<KeyValuePair<Sprite, Sprite>>, ref int)
Gets overrides for this
Declaration
public void GetOverrides(List<KeyValuePair<Sprite, Sprite>> overrides, ref int validCount)
Parameters
| Type | Name | Description |
|---|---|---|
| List<KeyValuePair<Sprite, Sprite>> | overrides | A list of overrides to fill |
| int | validCount | Returns the number of valid overrides for Sprites |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | The input overrides list is not valid |
GetTileAnimationData(Vector3Int, ITilemap, ref TileAnimationData)
Retrieves any tile animation data from the scripted tile.
Declaration
public override bool GetTileAnimationData(Vector3Int position, ITilemap tilemap, ref TileAnimationData tileAnimationData)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Int | position | Position of the Tile on the Tilemap. |
| ITilemap | tilemap | The Tilemap the tile is present on. |
| TileAnimationData | tileAnimationData | Data to run an animation on the tile. |
Returns
| Type | Description |
|---|---|
| bool | Whether the call was successful. |
Overrides
GetTileData(Vector3Int, ITilemap, ref TileData)
Retrieves any tile rendering data from the scripted tile.
Declaration
public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Int | position | Position of the Tile on the Tilemap. |
| ITilemap | tilemap | The Tilemap the tile is present on. |
| TileData | tileData | Data to render the tile. |
Overrides
OnEnable()
Callback when the tile is enabled
Declaration
public void OnEnable()
Override()
Updates the Rules with the Overrides set for this RuleOverrideTile
Declaration
public virtual void Override()
PrepareOverride()
Prepares the Overrides set for this RuleOverrideTile
Declaration
public void PrepareOverride()
RefreshTile(Vector3Int, ITilemap)
This method is called when the tile is refreshed.
Declaration
public override void RefreshTile(Vector3Int position, ITilemap tilemap)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Int | position | Position of the Tile on the Tilemap. |
| ITilemap | tilemap | The Tilemap the tile is present on. |
Overrides
StartUp(Vector3Int, ITilemap, GameObject)
StartUp is called on the first frame of the running Scene.
Declaration
public override bool StartUp(Vector3Int position, ITilemap tilemap, GameObject go)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3Int | position | Position of the Tile on the Tilemap. |
| ITilemap | tilemap | The Tilemap the tile is present on. |
| GameObject | go | The GameObject instantiated for the Tile. |
Returns
| Type | Description |
|---|---|
| bool | Whether StartUp was successful |