Unity Tile Properties 1.0
A dynamic and editor-friendly metadata system for 2D tilemap tiles in Unity 6.
Loading...
Searching...
No Matches
TileProperties.TilePropertiesManager Class Reference

Singleton object that keeps track of every tile property list in the game and passes property info to other objects. More...

Inheritance diagram for TileProperties.TilePropertiesManager:

Public Member Functions

bool AreListsNull ()
 Returns true or false if there have been any tile property lists assigned to this object or not.
bool DoesTileExistWithProperty (TileBase tile, ref TilePropertiesList included_list, bool throw_on_property_find=true)
 Takes a reference to a tile, and checks if it has been assigned to any tile property list.
bool DoesTilePropertyListExist (string list_name, ref TilePropertiesList included_list, bool throw_on_list_find=true)
 Takes a reference to a name of a tile property list, and checks if it exists in the project somewhere.
TileBase GetAffectedTile (string property_list_name, int index)
 Returns a 'TileBase' object reference to a tile that is affected by a specific tile property list.
List< TileBase > GetAllAffectedTiles (string property_list_name)
 Returns a list of all 'TileBase' objects affected by a specific tile property list.
void SetAffectedTile (TileBase tile, string property_list_name, int index)
 Sets the value of a specific 'TileBase' object reference in the list of affected tiles for a specific tile property list.
void AddAffectedTile (TileBase new_tile, string property_list_name)
 Add a new 'TileBase' object reference to the list of affected tiles for a specific tile property list.
void RemoveAffectedTile (TileBase old_tile, string property_list_name)
 Removes a reference to a 'TileBase' object, with the same name as 'new_tile', in a specific tile property list.
void RemoveAffectedTile (int index, string property_list_name)
 Removes a reference to a 'TileBase' object, at position 'index', in a specific tile property list.
void ClearAllAffectedTiles (string property_list_name)
 Clears all references to 'TileBase' objects inside of a specific tile property list.
object GetTileProperty (TileBase tile, string property_name, Type property_type, bool throw_on_tile_find=false, bool throw_on_property_find=false)
 Returns the generic unboxed value of a tile property variable, based on a reference to a tile object.
object GetTileProperty (string property_list_name, string property_name, Type property_type, bool throw_on_list_find=false, bool throw_on_property_find=false)
 Returns the generic unboxed value of a tile property variable, based on a reference to a tile property list's name.
void SetTileProperty (TileBase tile, string property_name, object new_value, bool throw_on_tile_find=false, bool throw_on_property_find=false)
 Sets the value of a tile property variable, based on a reference to a tile object.
void SetTileProperty (string property_list_name, string property_name, object new_value, bool throw_on_list_find=false, bool throw_on_property_find=false)
 Sets the value of a tile property variable, based on a reference to a tile property list's name.
void AddTileProperty (string property_list_name, string new_property_name, object new_property_value, bool throw_on_list_find=false)
 Add a new tile property variable to a specific tile property list.
void RemoveTileProperty (TileBase tile, string property_name, bool throw_on_tile_find=false, bool throw_on_property_find=false)
 Removes a tile property from a specific tile object.
void RemoveTileProperty (string property_list_name, string property_name, bool throw_on_list_find=false, bool throw_on_property_find=false)
 Removes a tile property from a specific tile property list reference.
void ClearTileProperties (TileBase tile)
 Takes a reference for a tile object, and removes all tile properties assigned to it.
void ClearTileProperties (string property_list_name)
 Takes a reference for a tile property list's name, and removes all properties assigned to that list.

Data Fields

List< TilePropertiesListTilePropertyLists = new()

Properties

static TilePropertiesManager Instance [get]
 Singleton instance of the manager object.

Detailed Description

Singleton object that keeps track of every tile property list in the game and passes property info to other objects.

This is where most tile-property-related activity happens during runtime, and where you can find essential getters and setters to access Tile Property Lists. This can be given its own object or attached to an already-existing tilemap object in the scene.

Member Function Documentation

◆ AddAffectedTile()

void TileProperties.TilePropertiesManager.AddAffectedTile ( TileBase new_tile,
string property_list_name )
inline

Add a new 'TileBase' object reference to the list of affected tiles for a specific tile property list.

Parameters
new_tileA soon-to-be added tile object reference from a Tilemap.
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.

◆ AddTileProperty()

void TileProperties.TilePropertiesManager.AddTileProperty ( string property_list_name,
string new_property_name,
object new_property_value,
bool throw_on_list_find = false )
inline

Add a new tile property variable to a specific tile property list.

Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.
new_property_nameThe string name of the soon-to-be added tile property.
new_property_valueThe object value that will be stored in the soon-to-be added property.
throw_on_list_findShould this throw an error log if no list can be found with this name?

◆ AreListsNull()

bool TileProperties.TilePropertiesManager.AreListsNull ( )
inline

Returns true or false if there have been any tile property lists assigned to this object or not.

◆ ClearAllAffectedTiles()

void TileProperties.TilePropertiesManager.ClearAllAffectedTiles ( string property_list_name)
inline

Clears all references to 'TileBase' objects inside of a specific tile property list.

Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.

◆ ClearTileProperties() [1/2]

void TileProperties.TilePropertiesManager.ClearTileProperties ( string property_list_name)
inline

Takes a reference for a tile property list's name, and removes all properties assigned to that list.

Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.

◆ ClearTileProperties() [2/2]

void TileProperties.TilePropertiesManager.ClearTileProperties ( TileBase tile)
inline

Takes a reference for a tile object, and removes all tile properties assigned to it.

Parameters
tileThe tile object reference from a Tilemap.

◆ DoesTileExistWithProperty()

bool TileProperties.TilePropertiesManager.DoesTileExistWithProperty ( TileBase tile,
ref TilePropertiesList included_list,
bool throw_on_property_find = true )
inline

Takes a reference to a tile, and checks if it has been assigned to any tile property list.



See also:

See also
DoesTilePropertyListExist
Parameters
tileThe tile object reference to check for.
included_listThe property list that the tile has been assigned to, if any are found.
throw_on_property_findShould this throw an error log if no associated list can be found for this tile?

◆ DoesTilePropertyListExist()

bool TileProperties.TilePropertiesManager.DoesTilePropertyListExist ( string list_name,
ref TilePropertiesList included_list,
bool throw_on_list_find = true )
inline

Takes a reference to a name of a tile property list, and checks if it exists in the project somewhere.



See also:

See also
DoesTileExistWithProperty
Parameters
list_nameThe name of the property list to check for.
included_listThe property list that the tile has been assigned to, if any are found.
throw_on_list_findShould this throw an error log if no list can be found of this name?

◆ GetAffectedTile()

TileBase TileProperties.TilePropertiesManager.GetAffectedTile ( string property_list_name,
int index )
inline

Returns a 'TileBase' object reference to a tile that is affected by a specific tile property list.



See also:

See also
GetAllAffectedTiles
Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.
indexThe list index for the requested tile.

◆ GetAllAffectedTiles()

List< TileBase > TileProperties.TilePropertiesManager.GetAllAffectedTiles ( string property_list_name)
inline

Returns a list of all 'TileBase' objects affected by a specific tile property list.

Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.

◆ GetTileProperty() [1/2]

object TileProperties.TilePropertiesManager.GetTileProperty ( string property_list_name,
string property_name,
Type property_type,
bool throw_on_list_find = false,
bool throw_on_property_find = false )
inline

Returns the generic unboxed value of a tile property variable, based on a reference to a tile property list's name.

Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.
property_nameThe name of the property to search the current property list for.
property_typeThe variable type of the property to search the property list(s) for.
throw_on_list_findShould this throw an error log if no list can be found with this name?
throw_on_property_findShould this throw an error log if no property can be found in the list attached to this tile?

◆ GetTileProperty() [2/2]

object TileProperties.TilePropertiesManager.GetTileProperty ( TileBase tile,
string property_name,
Type property_type,
bool throw_on_tile_find = false,
bool throw_on_property_find = false )
inline

Returns the generic unboxed value of a tile property variable, based on a reference to a tile object.

Parameters
tileThe tile object reference from a Tilemap.
property_nameThe name of the property to search the property list(s) for.
property_typeThe variable type of the property to search the property list(s) for.
throw_on_tile_findShould this throw an error log if no tile can be found with this property?
throw_on_property_findShould this throw an error log if no property can be found in the list attached to this tile?

◆ RemoveAffectedTile() [1/2]

void TileProperties.TilePropertiesManager.RemoveAffectedTile ( int index,
string property_list_name )
inline

Removes a reference to a 'TileBase' object, at position 'index', in a specific tile property list.



See also:

See also
ClearAllAffectedTiles
Parameters
indexThe list index for the removed tile.
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.

◆ RemoveAffectedTile() [2/2]

void TileProperties.TilePropertiesManager.RemoveAffectedTile ( TileBase old_tile,
string property_list_name )
inline

Removes a reference to a 'TileBase' object, with the same name as 'new_tile', in a specific tile property list.



See also:

See also
ClearAllAffectedTiles
Parameters
old_tileA soon-to-be removed tile object reference from a Tilemap.
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.

◆ RemoveTileProperty() [1/2]

void TileProperties.TilePropertiesManager.RemoveTileProperty ( string property_list_name,
string property_name,
bool throw_on_list_find = false,
bool throw_on_property_find = false )
inline

Removes a tile property from a specific tile property list reference.



See also:

See also
ClearTileProperties
Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.
property_nameThe string name of the soon-to-be removed tile property.
throw_on_list_findShould this throw an error log if no list can be found with this name?
throw_on_property_findShould this throw an error log if no property can be found in the list attached to this tile?

◆ RemoveTileProperty() [2/2]

void TileProperties.TilePropertiesManager.RemoveTileProperty ( TileBase tile,
string property_name,
bool throw_on_tile_find = false,
bool throw_on_property_find = false )
inline

Removes a tile property from a specific tile object.



See also:

See also
ClearTileProperties
Parameters
tileThe tile object reference from a Tilemap.
property_nameThe name of the soon-to-be removed tile property.
throw_on_tile_findShould this throw an error log if no tile can be found with this property?
throw_on_property_findShould this throw an error log if no property can be found in the list attached to this tile?

◆ SetAffectedTile()

void TileProperties.TilePropertiesManager.SetAffectedTile ( TileBase tile,
string property_list_name,
int index )
inline

Sets the value of a specific 'TileBase' object reference in the list of affected tiles for a specific tile property list.

Parameters
tileThe soon-to-be replaced tile object reference from a Tilemap.
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.
indexThe list index for the replaced tile.

◆ SetTileProperty() [1/2]

void TileProperties.TilePropertiesManager.SetTileProperty ( string property_list_name,
string property_name,
object new_value,
bool throw_on_list_find = false,
bool throw_on_property_find = false )
inline

Sets the value of a tile property variable, based on a reference to a tile property list's name.

Parameters
property_list_nameThe name of a 'TilePropertiesList' ScriptableObject in the Editor.
property_nameThe name of the property to search the property list(s) for.
new_valueThe new object value to set for this property in the list.
throw_on_list_findShould this throw an error log if no list can be found with this name?
throw_on_property_findShould this throw an error log if no property can be found in the list attached to this tile?

◆ SetTileProperty() [2/2]

void TileProperties.TilePropertiesManager.SetTileProperty ( TileBase tile,
string property_name,
object new_value,
bool throw_on_tile_find = false,
bool throw_on_property_find = false )
inline

Sets the value of a tile property variable, based on a reference to a tile object.

Parameters
tileThe tile object reference from a Tilemap.
property_nameThe name of the property to search the property list(s) for.
new_valueThe new object value to set for this property in the list.
throw_on_tile_findShould this throw an error log if no tile can be found with this property?
throw_on_property_findShould this throw an error log if no property can be found in the list attached to this tile?

Field Documentation

◆ TilePropertyLists

List<TilePropertiesList> TileProperties.TilePropertiesManager.TilePropertyLists = new()

Property Documentation

◆ Instance

TilePropertiesManager TileProperties.TilePropertiesManager.Instance
staticget

Singleton instance of the manager object.