TilePlus Version 5
Unity3D Tilemap Extension
Loading...
Searching...
No Matches
TilePlus.TpLib Class Reference

This static class maintains edit-time and run-time dictionaries which track TilePlusBase items on a per-tilemap basis. In-Editor, heirarchy and tilemap changes are tracked and dictionaries are updated as necessary. More...

Static Public Member Functions

static void CloneTilePlus (TilePlusBase instance, Vector3Int position, Tilemap map, bool allowLockedTiles=false)
 A TPT tile calls this in StartUp when cloning itself. NOT for general-purpose use.
static void RegisterTilePlus (TilePlusBase? instance, Vector3Int position, Tilemap? tilemap)
 Tiles must call this as part of their StartUp method in order to register the tile in the various data structures. This is automatically handled in TilePlusBase so anything that inherits from that doesn't need to do anything special.
static bool RemoveTileFromDb (Tilemap? map, Vector3Int position, bool fromGroup=false)
 Remove a tile from the database. NB - although this is public you never need to use it. This does not actually delete a tile. Use the normal Tilemap.SetTile with a null tile and the tilemap callbacks will cause the tile to be removed from the TpLib data structures.
static void AddToRefreshQueue (TilePlusBase tpb)
 Add a tile to the set of tiles that will be refreshed at the next TpLib TpLibUpdate. See TpLib.UpdateLoop
static ? Grid GetParentGrid (Transform current)
 Provide a Transform and this will look 'up' the heirarchy to find the parent Grid.
static void ForceOnTpLibChanged (TpLibChangeType changeType, bool isPartOfGroup, Vector3Int position, Tilemap? map)
 Force a OnTpLibChanged event.
static void SafeDestroy (UnityEngine.Object unityObject)
 A Safe destroy for Unity Objects.
static void SafeDeleteTile (Tilemap map, Vector3Int position)
 A safe way for tiles to delete themselves, deletion occurs at end of frame.
static void TpLog (string logString)
 Simpler Log for normal messages.
static void TpLogWarning (string logString)
 Simpler Log for warning messages.
static void TpLogError (string logString)
 Simpler log for error messages.
static void Resize (TpLibMemAlloc? m, bool rescan=true)
 Reallocate memory sizes.
static bool IsTilemapRegistered (Tilemap? map)
 Does a tilemap have any Tileplus tiles?
static ? TilePlusBase GetTile (Tilemap map, Vector3Int position)
 Get a tile from the master dictionary.
static ? T GetTile< T > (Tilemap map, Vector3Int position)
 Generic version of GetTile.
static ? T GetTileWithInterface< T > (Tilemap map, Vector3Int position)
 Generic version of GetTile, similar to GetTile<T> but with class constraint.
static bool HasTile (Tilemap map, Vector3Int position)
 Is there a tile at the provided position on the provided map: TilePlus tiles only!
static bool CutAndPasteTile (Tilemap map, Vector3Int currentPosition, Vector3Int newPosition, Func< Vector3Int, bool >? positionValidator=null, bool overwrite=false)
 Cut-and-paste operation: Move a tile from currentPosition to newPosition.
static bool SwapTwoTiles (Tilemap map, Vector3Int positionA, Vector3Int positionB)
 Swap two tileplus tiles.
static bool CopyAndPasteTile (Tilemap? destinationMap, TilePlusBase? instance, Vector3Int newPosition, Func< Vector3Int, bool >? positionValidator=null)
 Copy and paste a tile. Makes a copy of the passed-in TPT tile instance.
static bool RemoveMap (Tilemap tilemap)
 Delete all entries for specified Tilemap. Useful if you delete tilemaps at runtime. Note that Adding a tilemap programmatically and then adding TilePlusBase-derived tiles programatically will automatically update the DB when the tiles' StartUp method is invoked. So you do not have to add the tiles with RegisterTile or AddTileToDb.
static bool RemoveMap (int mapInstanceId)
 Remove a single map and all tagged/typed entries. DOES NOT remove tiles, DOES NOT delete the tilemap itself See also: RemoveMap(Tilemap)
static ? List< TilePlusBaseGetAllTilePlusBaseForMap (Tilemap map)
 Get a list of all of the TilePlusBase instances for a particular Tilemap.
static ? TilePlusBase GetTileWithIdAndType (int id, Type type, bool searchInterfaces=false)
 Get a TilePlusBase instance given its Instance ID and Type. If searchInterfaces is true then the interfaces dictionary is examined.
static void GetAllTilesInRegionForMap (Tilemap map, List< TilePlusBase > output, RectInt region)
 Get all TilePlus tiles in a region.
static void GetAllTiles< T > (List< T >? output, Func< T, TilePlusBase, bool >? filter=null)
 Place all tiles of Type T (not interfaces!) in all tilemaps into the output list.
static void GetAllTilesOfType (Tilemap? map, Type? matchThis, List< TilePlusBase >? output, Func< TilePlusBase, bool >? filter=null, RectInt? region=null, bool includeSubclasses=false)
 Get all tiles of a particular type from a specified tilemap. Optional filter Func delegate for pre-filtering of results. Normally excludes subclasses unless includeSubclasses is TRUE.
static int NumTilesWithInterface< T > (Func< TilePlusBase, NumTileWithInterfaceFilterResult >? filter=null)
 Are there any tiles with the specified interface? Most useful with the filter. For example, if the filter tests TilePlusBase.TileGridPosition one can filter for 'is there any tile at this position with this interface'.
static void GetAllTilesWithInterface< T > (List< TilePlusBase >? output, Tilemap? map=null, Type? matchThisTileType=null, Func< TilePlusBase, bool >? filter=null, bool includeSubclasses=false)
 Get all tiles from a particular tilemap, optionally filtered for a tile class type, but always filtered for a particular interface being implemented. Optional pre-filtering of results.
static void GetAllTilesWithInterfaceOfT< T > (List< T >? output, Func< T, TilePlusBase, bool >? filter=null, RectInt? region=null)
 Get all tiles with an interface of type T from all Maps. Optional prefilter delegate.
static void GetAllTagsUsedByTileType (Type tileType, HashSet< string >? tags)
 Populate a HashSet<string> with all tags used by a tile Type.
static void GetTilesWithTag (Tilemap? map, string tag, List< TilePlusBase >? output, Func< TilePlusBase, bool >? filter=null, RectInt? region=null)
 Get all tiles with a particular Tag. Optional prefilter.
static TilePlusBase GetFirstTileWithTag (Tilemap? map, string tag)
 Get the first tile with a particular tag.
static void GetAllTypesInDb (List< Type >? output, bool includeBase=false, bool getNonTilePlusTypes=false)
 Get all Types in the DB.
static bool HasGuid (Guid guid)
 Is a tile with a GUID already in the DB?
static ? TilePlusBase GetTilePlusBaseFromGuid (byte[] guid, bool extendedSearch=true)
 Get the TilePlusBase that's refenced by a GUID byte array.
static ? TilePlusBase GetTilePlusBaseFromGuid (string guid, bool extendedSearch=true)
 Get the TilePlusBase that's referenced by a GUID string.
static ? T GetTilePlusBaseOfTypeFromGuid< T > (string guid, bool extendedSearch=true)
 Get the TilePlusBase that's referenced by a GUID string.
static ? T GetTilePlusBaseOfTypeFromGuid< T > (Guid guid, bool extendedSearch=true)
 Get the TilePlusBase that's refenced by a GUID struct.
static ? TilePlusBase GetTilePlusBaseFromGuid (Guid guid, bool extendedSearch=true)
 Get the TilePlusBase that's refenced by a GUID struct.
static void GetAllPositionsForMap (Tilemap? map, HashSet< Vector3Int >? output, bool includeUnityTiles=true, bool clearOutput=true)
 Get a HashSet of Vector3Ints representing all occupied positions on a tilemap.
static bool IsTilemapLocked (Tilemap? map)
 Is the specified map Locked? Note that this will return true if there are any locked tilemaps in the same scene.
static bool IsTilemapLocked (int mapId)
 Is the specified map Locked?
static bool IsTilemapRegistered (int mapId)
 Is the specified map 'registered' ie is it being monitored because it has TPT tile?
static ? Tilemap FindTilemap (string tilemapName)
 Find a tilemap by name. Not just those with TPT tiles.
static ? Tilemap FindTilemap (int instanceId)
 Find a tilemap by InstanceId. Not just those with TPT tiles.
static ? Transform FindTilemapTransform (string tilemapName)
 Find a tilemap transform by name. Not just those with TPT tiles.
static void SceneScan ()
 Scan all scenes including complete scan of all scenes and their Tilemaps.
static void SceneScan (List< Tilemap >? maps, bool cleanState=true)
 Scans all scenes, gets all tilemaps, populate database.
static List< Scene > GetAllScenes (bool ignorePrefabStages=false)
 Get a list of all scenes.
static bool GetTilemapsInScene (Scene aScene, List< Tilemap >? tilemapsList, bool includeNonTptMaps=false)
 Get all tilemaps in the scene. Optional filtering.
static ulong DelayedCallback (Object? parent, Action? callback, string info, float delayInSeconds=0f, bool silent=false, Func< float, bool >? condition=null, bool testConditionFirst=false)
 Execute a simple callback after a delay in seconds.
static ulong InvokeRepeatingUntil (Object parent, string info, Func< float, bool > invokedFunc, float repeatInterval=0f, bool silent=true)
 Invoke a Func<float,bool> repeatedly. Convenience method for DelayedCallback use as timer.
static bool HasCallbackForId (ulong id)
 Is there an active callback for this ID?
static bool KillCallback (ulong id)
 Kill a pending callback (including those started by InvokeRepeating, although usually you kill those by returning false from that method's invoked callback).
static bool HasCallbackForObject (Object obj)
 Is there a callback already set up for a UnityEngine.Object?
static bool KillAllCallbacksForObject (Object obj)
 Kills any active delayed callbacks for a UnityEngine.Object.
static double double requeueTime StartAndRequeueTimeForId (ulong id)
static async Awaitable< bool > WhenAll (List< Awaitable< bool > > awaitables)
 Helper method to have WaitAll for Awaitable<bool>.
static async Awaitable WhenAll (List< Awaitable > awaitables)
 Helper method to have WaitAll for Awaitable.

Static Public Attributes

const int PaletteTilemapLayer = 31
 A constant that is the same as the Palette tilemap layer.
const int TilemapAndTagDictsInitSize = 128
 The initialization size for certain dicts.
const int GuidDictInitialSize = 64
 The initialization size for the GUID-to-tile Dictionary.
const int TypesInitSize = 16
 The initialization size for certain dicts.
const int PoolNewItemSize_Dict_V3I_Tpb = 4
 Size of Dictionaries (Vector3Int=to=TilePlusBase) when new ones are created in the pool.
const int PoolNewItemSize_List_Tpb = 8
 Size of Lists of TilePlusBase when new ones are created in the pool.
const string ReservedTag = "------"
 This tag can't be used by users.
const uint MaxDeferredCallbackInitialValue = 32
 Initial value for maximum number of deferred callbacks per update.
const uint MaxClonesInitialValue = 32
 Initial value for maximum number of Clonings per update.
static double startTime
 Get the Start and Requeue times for an ID.
static ? Func< bool > S_OnResetPlayerLoop
 Callback for optional custom takedown of player loop. Occurs before any effect on PlayerLoop. If Func returns true then it's assumed that the Func did it's own work and no other action is needed. If it returns false then the PlayerLoop is set to the default Unity player loop (which would overwrite any actions taken in the Func)..

Properties

static bool IsPlayMode [get]
 In-Editor, returns true if EditorApplication.isPlayingOrWillChangePlaymode is true. In a built app this always returns true. One would expect the compiler to removed this method when it optimizes in an non-editor build.
static bool IsSceneScanActive [get]
 Property to determine if a scene scan is in progress.
static bool InhibitOnTpLibChanged [get, set]
 Inhibits OnTpLibChangedEvents:
static bool InhibitTilemapCallbacks [get, set]
 Inhibits tilemap callbacks (OnTilemapPositionChanged, OntilemapTileChanged). Useful if you're doing a lot of Tilemap operations but don't want the system to handle these callbacks. Note that the internal DBs of TpLib will be incorrect; use SceneScan afterwards. That's not automatic!! The effect of this property isn't the same as InhibitOnTpLibChanged which just inhibits the callback. InhibitTilemapCallbacks causes the tilemap callbacks (OnTilemapPositionChanged, OntilemapTileChanged) to immediately return.
static bool TpLibIsInitialized [get]
 Returns true if the TpLib is ready to access. Cloning queue is examined to ensure no delayed registrations.
static int TilemapsCount [get]
 How many tilemaps are being tracked.
static ? Dictionary< Guid, TilePlusBaseOptionalGuidToTileMapping [get, set]
 Allows accessing the optional Guid maps. See GetTilePlusBaseFromGuid variants.
static int TaggedTilesCount [get]
 Number of different tags.
static int TileTypesCount [get]
 Number of different Types.
static int TileInterfacesCount [get]
 Number of interfaces.
static int GuidToTileCount [get]
 Number of GUIDs.
static IEnumerable< string > GetAllTagsInDb [get]
 Get all tags.
static Dictionary< Guid, TilePlusBase >.ValueCollection GetAllTilesRaw [get]
 Get all tiles. Note: uses GuidToTile dictionary's Values.
static List< Vector3Int > NonTppTilesAddedOrModified [get]
 A list of non tileplus tiles that were added or modified.
static int CurrentActiveDelayedCallbacks [get]
 How many active delayed callbacks.
static int CloneQueueMaxDepth [get]
 For statistics. Observable in SysInfo window.
static int CloneQueueDepth [get]
 For statistics. Observable in SysInfo window.
static int RefreshQueueDepth [get]
 For statistics. Observable in SysInfo window.
static bool CloneOrRefreshBusy [get]
 True if tiles are waiting to clone or refresh.
static int RefreshQueueMaxDepth [get]
 For statistics. Observable in SysInfo window.
static int RefreshQueuePerUpdate = 32 [get]
 For statistics. Observable in SysInfo window.
static float FrameRate [get]
 publicly-accesssible frame rate.
static int WorstFrameRate = 500000 [get]
 Worst frame rate for current Run session.
static int BestFrameRate = 0 [get]
 Best frame rate for current Run session.
static float TargetFrameRate = 60 [get, set]
 Target frame rate for current Run session.
static bool TargetFrameRateMet [get]
 Is the target frame rate met?
static bool UsingPlayerLoop [get]
 Is the Tp update pump using the Player loop?
static int DeferredQueueMaxDepth [get]
 For statistics. Observable in SysInfo window.
static int LargestSyncTileCount [get]
 For statistics. Observable in SysInfo window.
static int LargestPosChangedCount [get]
 For statistics. Observable in SysInfo window.
static int DeferredQueueDepth [get]
 For statistics. Observable in SysInfo window.
static uint MaxNumClonesPerUpdate [get, set]
 Set the maximum number of tile clones that can occur on one TpLibUpdate. Note that if you set this to zero or LT 0 then the value used is uint.maxvalue which is a pretty big number. This value should be relatively small, but the exact value is app-dependent. If you never place TPT tiles in a running game then this can be ignored. A too-small value will increase the delay from when a TPT tile is painted to when it is cloned. That can affect the appearance of animated tiles.
static uint MaxNumDeferredCallbacksPerUpdate [get, set]
 Set the maximum number of deferred callbacks that can occur on one TpLibUpdate. Note that if you set this to zero or LT 0 then the value used is long.maxvalue which is a pretty big number. This value should be relatively small, but the exact value is app-dependent.
static ? TpLibMemAlloc MemAllocSettings [get]
 Get the current memory allocation settings for TpLib.
static string VersionInformation [get]
 Get a string with Name, Version, Build Timestamp.
static string ShortVersionInformation [get]
 Get a string with abbreviated version information.
static bool FrameRateFail [get]
 Set true when frame rate is lower than the target.
static List< string > GetDelayedCallbackStates [get]
 Get a list of all ToString from the delayed callbacks. Not for use in an update loop @ runtime aside from debugging. Used by SystemInfo window's Dump button.
static bool PauseTpLibUpdate [get, set]
 Set this TRUE to stop all updating in TpLibUpdate. This stops all tweening, callbacks, tile cloning, etc.
static bool UpdateLoopRunning [get]
 True if the internal update loop is running.
static ulong UpdateLoopCount [get]
 TpLibUpdate loop count, for diags.

Events

static ? Action< TpLibChangeType, bool, Vector3Int, Tilemap?> OnTpLibChanged
 Event when the TpLib changes due to an addition or deletion. NOTE that this event is NOT cleared when a scene loads or unloads, so if you have anything that could be deleted on a scene (un)load, be sure to use OnEnable and OnDisable to add and remove your callback target. ChangeType, bool is false for single tiles, true if this is part of a group of changes, Position, map.
static ? Action< Tilemap, Tilemap.SyncTile[]> OnTilemapTileChangedHook
 If you want to subscribe to Tilemap.tilemapTileChanged use this event instead. The handler for this event in TpLib will also invoke these; its more efficient. Note that this is not always invoked, see if it is appropriate for your use. Note: don't use for monobehaviours or tiles.
static ? Action< Tilemap, NativeArray< Vector3Int > > OnTilemapPositionsChangedHook
 If you want to subscribe to Tilemap.tilemapPositionsChanged use this event instead. The handler for this event in TpLib will also invoke these; its more efficient. Note that this is not always invoked, see if it is appropriate for your use. Note: don't use for monobehaviours or tiles.

Detailed Description

This static class maintains edit-time and run-time dictionaries which track TilePlusBase items on a per-tilemap basis. In-Editor, heirarchy and tilemap changes are tracked and dictionaries are updated as necessary.

It would be a bad idea to change anything in this class.

Member Function Documentation

◆ AddToRefreshQueue()

void TilePlus.TpLib.AddToRefreshQueue ( TilePlusBase tpb)
static

Add a tile to the set of tiles that will be refreshed at the next TpLib TpLibUpdate. See TpLib.UpdateLoop

Parameters
tpb

◆ CloneTilePlus()

void TilePlus.TpLib.CloneTilePlus ( TilePlusBase instance,
Vector3Int position,
Tilemap map,
bool allowLockedTiles = false )
static

A TPT tile calls this in StartUp when cloning itself. NOT for general-purpose use.

Parameters
instanceTilePlusBase instance
positioncurrent tile position
mapcurrent tile's parent Tilemap
allowLockedTilesclone a locked tile if true. Normally false.

The clone 'requests' are put into a Queue and execute on the next EditorUpdate (not playing, in Editor) or on the text tick of the 'pump' (see TpLibTasks). When an item is taken out of the Queue the tile is cloned. If at that time the Tilemap or TPB instance values saved in the CloningData class instance removed from the queen turn out to be null then no action is taken and the tile isn't cloned. And yet another note about runtime use: many tiles painted at once will enlarge the queue and when the next TpLibUpdate occurs all of the Cloning will be done at once. If that's an issue, use the MaxNumClonesPerUpdate property to non-zero (zero indicates do all of them).

◆ CopyAndPasteTile()

bool TilePlus.TpLib.CopyAndPasteTile ( Tilemap? destinationMap,
TilePlusBase? instance,
Vector3Int newPosition,
Func< Vector3Int, bool >? positionValidator = null )
static

Copy and paste a tile. Makes a copy of the passed-in TPT tile instance.

Parameters
destinationMaptilemap to paste the tile
instancetile to copy and paste
newPositionthe position. Note if there's a tile there then nothing happens and the return value is false.
positionValidatorFunc that accepts a Vector3Int position and returns a bool. Can be used to test if the move position is OK.
Returns
false for error (instantiation error, positionValidator returns false, destination position occupied

◆ CutAndPasteTile()

bool TilePlus.TpLib.CutAndPasteTile ( Tilemap map,
Vector3Int currentPosition,
Vector3Int newPosition,
Func< Vector3Int, bool >? positionValidator = null,
bool overwrite = false )
static

Cut-and-paste operation: Move a tile from currentPosition to newPosition.

Parameters
mapThe tilemap
currentPositionThe current position
newPositionThe new position
positionValidatorFunc that accepts a Vector3Int position and returns a bool. Can be used to test if the move position is OK.
overwriteOverwrite new positions if true, if false, will not overwrite.
Returns
true for successful move, false if no tile or optional positionValidator returns false at current position OR if there IS a tile at the newPos

Cut/Paste from one tilemap to another isn't supported.

◆ DelayedCallback()

ulong TilePlus.TpLib.DelayedCallback ( Object? parent,
Action? callback,
string info,
float delayInSeconds = 0f,
bool silent = false,
Func< float, bool >? condition = null,
bool testConditionFirst = false )
static

Execute a simple callback after a delay in seconds.

Parameters
parentParent UnityEngine.Object. If non-null, checks for null before callback invoked.
callbackCallback
delayInSecondsdelay before callback is excuted in seconds e.g., 0.5f is 500 msec. Note that a negative delay is changed to 0 and an optional warning is printed to the console
infoInfo string for logs
silentif true, no messages except errors
conditiona Func sent Time.deltaTime (float) returning bool. If this func returns false then the delayed callback is placed back in the deferred queue.
testConditionFirstIf true, the condition is tested before the duration. Use to have a condition with a max timeout.

ID of the callback. Can use this to kill the callback without execing the callback method. Note that a return value of 0 is an error indication.

If delayInSeconds is omitted, the default is 0 sec, so the next pass thru the UpdateLoop (in TpLibTasks) will cause the callback to be invoked. Note that this is different: in an built app or Editor-Play mode it's an internal update loop that's synchronized with ENDOFFRAME (Awaitable-based pump) or POSTLATEUPDATE (Player loop mode). In Editor-edit mode it's in time with EditorApplication.update. This is VERY useful for trivial delays like when you want to call some method from an within a tile's initialization (see TilePlusBase) or from within OnGUI or the like eg from IMGUI code: situations where many sorts of ordinary things you'd like to do will cause beaucoup errors or crash the Editor.

NOTE: this is not intended to be used in a loop where this method is entered very frequently.

◆ FindTilemap() [1/2]

? Tilemap TilePlus.TpLib.FindTilemap ( int instanceId)
static

Find a tilemap by InstanceId. Not just those with TPT tiles.

Parameters
instanceIdname of tilemap to search for
Returns
Tilemap reference or null if not found.

◆ FindTilemap() [2/2]

? Tilemap TilePlus.TpLib.FindTilemap ( string tilemapName)
static

Find a tilemap by name. Not just those with TPT tiles.

Parameters
tilemapNamename of tilemap to search for
Returns
Tilemap reference or null if not found.

◆ FindTilemapTransform()

? Transform TilePlus.TpLib.FindTilemapTransform ( string tilemapName)
static

Find a tilemap transform by name. Not just those with TPT tiles.

Parameters
tilemapNamename of tilemap to search for
Returns
Transfor reference or null

◆ ForceOnTpLibChanged()

void TilePlus.TpLib.ForceOnTpLibChanged ( TpLibChangeType changeType,
bool isPartOfGroup,
Vector3Int position,
Tilemap? map )
static

Force a OnTpLibChanged event.

This can be used when you're doing a bulk operation that affects a lot of tiles. That avoids many change events. Use InhibitOnTpLibChanged=true, then false, then this method.

Parameters
changeTypeA value from the TpLibChangeType enum
isPartOfGrouptrue if this is part of a group of changes
positionposition, if appropriate
mapTilemap (can be null)

◆ GetAllPositionsForMap()

void TilePlus.TpLib.GetAllPositionsForMap ( Tilemap? map,
HashSet< Vector3Int >? output,
bool includeUnityTiles = true,
bool clearOutput = true )
static

Get a HashSet of Vector3Ints representing all occupied positions on a tilemap.

Parameters
mapThe tilemap to use
outputHashSet for output. Note is cleared unless clearOutput is false
includeUnityTilesreport on Unity tiles as well (slower)
clearOutputClear the HashSet if true (default)

Map.CompressBounds is used when includeUnityTiles=true

◆ GetAllScenes()

List< Scene > TilePlus.TpLib.GetAllScenes ( bool ignorePrefabStages = false)
static

Get a list of all scenes.

Parameters
ignorePrefabStagesSet true to ignore prefab stages
Returns
a list of scenes

NOTE that the returned list is the SAME list for each method call, so use care.

◆ GetAllTagsUsedByTileType()

void TilePlus.TpLib.GetAllTagsUsedByTileType ( Type tileType,
HashSet< string >? tags )
static

Populate a HashSet<string> with all tags used by a tile Type.

Parameters
tileTypethe Type of tile
tagsHashSet<string> Cleared before use.

Tags are modified with Trim() to remove leading and trailing spaces.

◆ GetAllTilePlusBaseForMap()

? List< TilePlusBase > TilePlus.TpLib.GetAllTilePlusBaseForMap ( Tilemap map)
static

Get a list of all of the TilePlusBase instances for a particular Tilemap.

Parameters
mapThe Tilemap
Returns
a List of TilePlusBase instances for the map or null for invalid map

◆ GetAllTiles< T >()

void TilePlus.TpLib.GetAllTiles< T > ( List< T >? output,
Func< T, TilePlusBase, bool >? filter = null )
static

Place all tiles of Type T (not interfaces!) in all tilemaps into the output list.

Parameters
outputresults list. Is cleared. If list is null it's an error
filterOptional delegate for filtering, Func with an instance of Type T and a TilePlusBase - returns bool
Template Parameters
TType is TilePlusBase or subclasses. NOT interfaces!

Will only find the exact type specified by the TypeParam, not super or subclasses.

Type Constraints
T :TilePlusBase 

◆ GetAllTilesInRegionForMap()

void TilePlus.TpLib.GetAllTilesInRegionForMap ( Tilemap map,
List< TilePlusBase > output,
RectInt region )
static

Get all TilePlus tiles in a region.

Parameters
mapTilemap
outputprovide an output list. List IS NOT CLEARED BEFORE USE!
regionprovide a region

◆ GetAllTilesOfType()

void TilePlus.TpLib.GetAllTilesOfType ( Tilemap? map,
Type? matchThis,
List< TilePlusBase >? output,
Func< TilePlusBase, bool >? filter = null,
RectInt? region = null,
bool includeSubclasses = false )
static

Get all tiles of a particular type from a specified tilemap. Optional filter Func delegate for pre-filtering of results. Normally excludes subclasses unless includeSubclasses is TRUE.

Parameters
mapa tilemap reference. If map==null, then all tiles of Type are returned regardless of map.
matchThisA type, usually from Typeof() but could be GetType(). NOTE: if this is null then ALL tile instances are returned
outputA List for the output. Is Cleared. Error if null.
filterOptional delegate for filtering
regionOptional prefilter, if !null position must be contained in the RectInt.
includeSubclassesif true and if matchThis != null then if the tile type isn't located directly, search for tiles that are a subclass of matchThis


faster without map specification or filter delegate. If nothing is found then the list will be empty

◆ GetAllTilesWithInterface< T >()

void TilePlus.TpLib.GetAllTilesWithInterface< T > ( List< TilePlusBase >? output,
Tilemap? map = null,
Type? matchThisTileType = null,
Func< TilePlusBase, bool >? filter = null,
bool includeSubclasses = false )
static

Get all tiles from a particular tilemap, optionally filtered for a tile class type, but always filtered for a particular interface being implemented. Optional pre-filtering of results.

Template Parameters
T
Parameters
outputList<TilePlusBase>. Is Cleared. if null is error.
mapa Tilemap reference. If null, then use all tilemaps
matchThisTileTypeOptional prefilter for a particular tile Type. If null, all tiles are examined in one map (map!=null) or all maps (map==null).
filterOptional results filter.
includeSubclassesif matchThisTileType != null and this is true then subclasses are examined as well

The T is the interface. The list 'output' will be empty if nothing is found.

◆ GetAllTilesWithInterfaceOfT< T >()

void TilePlus.TpLib.GetAllTilesWithInterfaceOfT< T > ( List< T >? output,
Func< T, TilePlusBase, bool >? filter = null,
RectInt? region = null )
static

Get all tiles with an interface of type T from all Maps. Optional prefilter delegate.

This is the best choice for most uses. The filter delegate is like (T,tpb)=> bool func – using the param available by the interface type T or the TilePlusBase tpb.

Parameters
outputList of type T. Is Cleared or, if null is error.
Template Parameters
TType of the interface desired
Parameters
filterOptional results filter.
regionOptional region, applied before filter.

◆ GetAllTypesInDb()

void TilePlus.TpLib.GetAllTypesInDb ( List< Type >? output,
bool includeBase = false,
bool getNonTilePlusTypes = false )
static

Get all Types in the DB.

Parameters
outputlist of Types
includeBaseinclude tileplusbase type in output
getNonTilePlusTypesGet all types from TileBase on up. Note: much slower since all open scenes and tilemaps are scanned.

◆ GetFirstTileWithTag()

TilePlusBase TilePlus.TpLib.GetFirstTileWithTag ( Tilemap? map,
string tag )
static

Get the first tile with a particular tag.

Parameters
mapmap to check, can be null (note is faster if map is null)
tagtag to look for
Returns
TilePlusBase.

◆ GetParentGrid()

? Grid TilePlus.TpLib.GetParentGrid ( Transform current)
static

Provide a Transform and this will look 'up' the heirarchy to find the parent Grid.

Parameters
currentthe starting point
Returns
a Grid or null if not found

◆ GetTile()

? TilePlusBase TilePlus.TpLib.GetTile ( Tilemap map,
Vector3Int position )
static

Get a tile from the master dictionary.

Parameters
mapwhich tilemap
positiongrid position
Returns
the TilePlusBase instance or null if map is null OR if not found OR the map has no TilePlus tiles

◆ GetTile< T >()

? T TilePlus.TpLib.GetTile< T > ( Tilemap map,
Vector3Int position )
static

Generic version of GetTile.

Parameters
mapwhich tilemap
positiongrid position
Template Parameters
TType parameter, must be TilePlusBase or subclass
Returns
the tile or null if: map id null, the map has no TPT tiles, OR that position has no TPT tile, OR the tile isn't of type T.

To have T as an interface, use GetTileWithInterface

Type Constraints
T :TilePlusBase 

◆ GetTilemapsInScene()

bool TilePlus.TpLib.GetTilemapsInScene ( Scene aScene,
List< Tilemap >? tilemapsList,
bool includeNonTptMaps = false )
static

Get all tilemaps in the scene. Optional filtering.

Parameters
aSceneA scene to test
tilemapsListpre-allocated List of tilemaps.
includeNonTptMapsif true include maps with no TPT tiles.
Returns
true for success, or false for invalid scene/null-ref variable (compiler should warn)

Note that tilemapsList isn't cleared: intentional

◆ GetTilePlusBaseFromGuid() [1/3]

? TilePlusBase TilePlus.TpLib.GetTilePlusBaseFromGuid ( byte[] guid,
bool extendedSearch = true )
static

Get the TilePlusBase that's refenced by a GUID byte array.

Parameters
guidThe GUID byte array

///

Parameters
extendedSearchtrue (default) use the ZoneManager and/or s_OptionalGuidToTileMappings to try and find the TPT tile from the guid. if the primary lookup fails.
Returns
null if not found or TilePlusBase instance.

extendedSearch param should be set false for improved efficiency when using Chunkified TileBundles ie when using the ChunkZoneSelector.

◆ GetTilePlusBaseFromGuid() [2/3]

? TilePlusBase TilePlus.TpLib.GetTilePlusBaseFromGuid ( Guid guid,
bool extendedSearch = true )
static

Get the TilePlusBase that's refenced by a GUID struct.

Parameters
guidGuid struct
extendedSearchtrue (default) use the ZoneManager and/or s_OptionalGuidToTileMappings to try and find the TPT tile from the guid. if the primary lookup fails.
Returns
null if not found or a TilePlusBase instance

extendedSearch param should be set false for improved efficiency when using Chunkified TileBundles ie when using the ChunkZoneSelector.

◆ GetTilePlusBaseFromGuid() [3/3]

? TilePlusBase TilePlus.TpLib.GetTilePlusBaseFromGuid ( string guid,
bool extendedSearch = true )
static

Get the TilePlusBase that's referenced by a GUID string.

Parameters
guidGuid string
extendedSearchtrue (default) use the ZoneManager and/or s_OptionalGuidToTileMappings to try and find the TPT tile from the guid. if the primary lookup fails.
Returns
null if not found or a TilePlusBase instance

extendedSearch param should be set false for improved efficiency when using Chunkified TileBundles ie when using the ChunkZoneSelector.

◆ GetTilePlusBaseOfTypeFromGuid< T >() [1/2]

? T TilePlus.TpLib.GetTilePlusBaseOfTypeFromGuid< T > ( Guid guid,
bool extendedSearch = true )
static

Get the TilePlusBase that's refenced by a GUID struct.

Parameters
guidGuid struct
extendedSearchtrue (default) use the ZoneManager and/or s_OptionalGuidToTileMappings to try and find the TPT tile from the guid. if the primary lookup fails.
Returns
null if not found or if what's found isn't of Type T

extendedSearch param should be set false for improved efficiency when using Chunkified TileBundles ie when using the ChunkZoneSelector.

Type Constraints
T :TilePlusBase 

◆ GetTilePlusBaseOfTypeFromGuid< T >() [2/2]

? T TilePlus.TpLib.GetTilePlusBaseOfTypeFromGuid< T > ( string guid,
bool extendedSearch = true )
static

Get the TilePlusBase that's referenced by a GUID string.

Parameters
guidGuid string
extendedSearchtrue (default) use the ZoneManager and/or s_OptionalGuidToTileMappings to try and find the TPT tile from the guid. if the primary lookup fails.
Returns
null if not found or returned tile isn't of Type T

extendedSearch param should be set false for improved efficiency when using Chunkified TileBundles ie when using the ChunkZoneSelector.

Type Constraints
T :TilePlusBase 

◆ GetTilesWithTag()

void TilePlus.TpLib.GetTilesWithTag ( Tilemap? map,
string tag,
List< TilePlusBase >? output,
Func< TilePlusBase, bool >? filter = null,
RectInt? region = null )
static

Get all tiles with a particular Tag. Optional prefilter.

Parameters
mapa Tilemap reference, if null, search all Tilemaps w TilePlus tiles.
tagthe tag to search for
outputa List<TilePlusBase> - if list is null is an error otherwise list is cleared
filterOptional prefilter
regionOptional prefilter, if !null position must be contained in the RectInt.

list is empty if no tiles found.

◆ GetTileWithIdAndType()

? TilePlusBase TilePlus.TpLib.GetTileWithIdAndType ( int id,
Type type,
bool searchInterfaces = false )
static

Get a TilePlusBase instance given its Instance ID and Type. If searchInterfaces is true then the interfaces dictionary is examined.

Parameters
idinstance ID to search for
typetile's Type from typeof operator
searchInterfacesIf this is true, search the Interfaces dictionary
Returns
a TilePlusBase instance or null.

◆ GetTileWithInterface< T >()

? T TilePlus.TpLib.GetTileWithInterface< T > ( Tilemap map,
Vector3Int position )
static

Generic version of GetTile, similar to GetTile<T> but with class constraint.

Parameters
mapwhich tilemap
positiongrid position
Template Parameters
TType parameter, must be class (or commonly, an interface).
Returns
the tile or null if the tile 'as T' evals to null or if the map has no tiles.
Type Constraints
T :class 

◆ HasCallbackForId()

bool TilePlus.TpLib.HasCallbackForId ( ulong id)
static

Is there an active callback for this ID?

Parameters
idcallback ID
Returns
true if it is in the queue

◆ HasCallbackForObject()

bool TilePlus.TpLib.HasCallbackForObject ( Object obj)
static

Is there a callback already set up for a UnityEngine.Object?

Parameters
objUnityEngine.Object
Returns
false if not found or if passed-in object is null.

◆ HasGuid()

bool TilePlus.TpLib.HasGuid ( Guid guid)
static

Is a tile with a GUID already in the DB?

Parameters
guida GUID
Returns
true if it exists

Used primarily by TilePlusBase code to determine if a TilePlusBase instance is already registered

◆ HasTile()

bool TilePlus.TpLib.HasTile ( Tilemap map,
Vector3Int position )
static

Is there a tile at the provided position on the provided map: TilePlus tiles only!

Parameters
maptilemap to look at
positionposition to examine
Returns
true if the specified map has tile; otherwise, false.

◆ InvokeRepeatingUntil()

ulong TilePlus.TpLib.InvokeRepeatingUntil ( Object parent,
string info,
Func< float, bool > invokedFunc,
float repeatInterval = 0f,
bool silent = true )
static

Invoke a Func<float,bool> repeatedly. Convenience method for DelayedCallback use as timer.

Parameters
parentparent Object. Cannot be null
infoInfo string for debugging
repeatIntervalinterval between calls to invokedFunc
invokedFunca Func<float,bool> See remarks
silentno console messages if true (default)
Returns
ID which can be used to terminate the process

See also DelayedCallback

The invokedFunc takes a float (delta time) and returns a bool. If the returned value is true then the repeated invokes stop. IE return false as long as you want the invokes to continue. One can also use KillCallback to terminate.

◆ IsTilemapLocked() [1/2]

bool TilePlus.TpLib.IsTilemapLocked ( int mapId)
static

Is the specified map Locked?

Parameters
mapIda tilemap instance ID
Returns
true if the map is locked

◆ IsTilemapLocked() [2/2]

bool TilePlus.TpLib.IsTilemapLocked ( Tilemap? map)
static

Is the specified map Locked? Note that this will return true if there are any locked tilemaps in the same scene.

Parameters
mapa tilemap
Returns
true if the map is locked

◆ IsTilemapRegistered() [1/2]

bool TilePlus.TpLib.IsTilemapRegistered ( int mapId)
static

Is the specified map 'registered' ie is it being monitored because it has TPT tile?

Parameters
mapIda tilemap instance Id
Returns
true if the map is being monitored

◆ IsTilemapRegistered() [2/2]

bool TilePlus.TpLib.IsTilemapRegistered ( Tilemap? map)
static

Does a tilemap have any Tileplus tiles?

Parameters
mapThe map.
Returns
true if [is tilemap registered] [the specified map]; otherwise, false.

◆ KillAllCallbacksForObject()

bool TilePlus.TpLib.KillAllCallbacksForObject ( Object obj)
static

Kills any active delayed callbacks for a UnityEngine.Object.

Parameters
objUnityEngine.Object
Returns
false if not found or passed-in obj value is null.

Not for frequent use: creates garbage

◆ KillCallback()

bool TilePlus.TpLib.KillCallback ( ulong id)
static

Kill a pending callback (including those started by InvokeRepeating, although usually you kill those by returning false from that method's invoked callback).

Parameters
idthe ID returned by DelayedCallback.
Returns
false if not found
See also
KillAllCallbacksForObject

◆ NumTilesWithInterface< T >()

int TilePlus.TpLib.NumTilesWithInterface< T > ( Func< TilePlusBase, NumTileWithInterfaceFilterResult >? filter = null)
static

Are there any tiles with the specified interface? Most useful with the filter. For example, if the filter tests TilePlusBase.TileGridPosition one can filter for 'is there any tile at this position with this interface'.

Parameters
filteroptional filter
Template Parameters
TInterface type. NOT tile type
Returns
0 for none found, 1..N count of tiles found. Note dependence on return value of filter delegate

The filter accepts a TilePlusBase instance and returns a value from the NumTileWithInterfaceFilterResult enum. Use PassAndQuit if the method should exit after the filter test. This can be used to avoid counting the exact number of matching tiles if all you care about is that at least one was found.

◆ RegisterTilePlus()

void TilePlus.TpLib.RegisterTilePlus ( TilePlusBase? instance,
Vector3Int position,
Tilemap? tilemap )
static

Tiles must call this as part of their StartUp method in order to register the tile in the various data structures. This is automatically handled in TilePlusBase so anything that inherits from that doesn't need to do anything special.

Parameters
instanceThe tile plus base instance.
positionThe tile position
tilemapThe tile's parent tilemap

Note that Adding a tilemap programmatically and then adding TilePlusBase-derived tiles programatically will automatically update the DB when the tiles' StartUp method is invoked.

◆ RemoveMap() [1/2]

bool TilePlus.TpLib.RemoveMap ( int mapInstanceId)
static

Remove a single map and all tagged/typed entries. DOES NOT remove tiles, DOES NOT delete the tilemap itself See also: RemoveMap(Tilemap)

Parameters
mapInstanceIdthe instance ID of the map to remove
Returns
true if XXXX, false otherwise.

◆ RemoveMap() [2/2]

bool TilePlus.TpLib.RemoveMap ( Tilemap tilemap)
static

Delete all entries for specified Tilemap. Useful if you delete tilemaps at runtime. Note that Adding a tilemap programmatically and then adding TilePlusBase-derived tiles programatically will automatically update the DB when the tiles' StartUp method is invoked. So you do not have to add the tiles with RegisterTile or AddTileToDb.

Parameters
tilemapThe tilemap.
Returns
true for success, false if tilemap not found

IMPORTANT: DOES NOT DELETE A TILEMAP, USE BEFORE YOU DELETE THE TILEMAP.

◆ RemoveTileFromDb()

bool TilePlus.TpLib.RemoveTileFromDb ( Tilemap? map,
Vector3Int position,
bool fromGroup = false )
static

Remove a tile from the database. NB - although this is public you never need to use it. This does not actually delete a tile. Use the normal Tilemap.SetTile with a null tile and the tilemap callbacks will cause the tile to be removed from the TpLib data structures.

Parameters
mapWhat map is it on?
positionwhat's its position?
fromGroupSet true if you're deleting this tile as one of a group of deletions. This parameter is not used at runtime
Returns
True for success, false for errors.

◆ Resize()

void TilePlus.TpLib.Resize ( TpLibMemAlloc? m,
bool rescan = true )
static

Reallocate memory sizes.

Parameters
man instance of TpLibMemAlloc
rescancall TpLib.SceneScan after reallocation. This is generally required since reallocation wipes out all of the stored TilePlus tile data.

This should be done immediately/soon after startup. Intended for runtime use only. Use in editor mode isn't useful since each scripting reload would wipe this out. Also, statically-declared lists and dictionaries won't be resized below their current size. Also, CleanState is used to release pooled items. Note that doing so resets MaxNumClonesPerUpdate and MaxNumDeferredCallbacksPerUpdate to their initial values.

TpLibInit

◆ SafeDeleteTile()

void TilePlus.TpLib.SafeDeleteTile ( Tilemap map,
Vector3Int position )
static

A safe way for tiles to delete themselves, deletion occurs at end of frame.

Parameters
mapTilemap
positionPosition.

See 'TreasureChestTile' from the Layout demo for an example.

◆ SafeDestroy()

void TilePlus.TpLib.SafeDestroy ( UnityEngine.Object unityObject)
static

A Safe destroy for Unity Objects.

Parameters
unityObjectObject to destroy

Handles in-editor and play-mode correctly

◆ SceneScan() [1/2]

void TilePlus.TpLib.SceneScan ( )
static

Scan all scenes including complete scan of all scenes and their Tilemaps.

◆ SceneScan() [2/2]

void TilePlus.TpLib.SceneScan ( List< Tilemap >? maps,
bool cleanState = true )
static

Scans all scenes, gets all tilemaps, populate database.

Parameters
mapsOptional tilemaps list. If provided, scenes not scanned nor state cleaned.
cleanStateexecute CleanState (default=true)

Clears the database if tilemaps list not provided.

◆ StartAndRequeueTimeForId()

double double requeueTime TilePlus.TpLib.StartAndRequeueTimeForId ( ulong id)
static

◆ SwapTwoTiles()

bool TilePlus.TpLib.SwapTwoTiles ( Tilemap map,
Vector3Int positionA,
Vector3Int positionB )
static

Swap two tileplus tiles.

Parameters
mapTilemap (must be the same for both tiles)
positionATile Position A
positionBTile Position B
Returns
false if either tile isn't TilePlus tile or if nothing at one of the two positions.

◆ TpLog()

void TilePlus.TpLib.TpLog ( string logString)
static

Simpler Log for normal messages.

Parameters
logStringtext to add to the log

◆ TpLogError()

void TilePlus.TpLib.TpLogError ( string logString)
static

Simpler log for error messages.

Parameters
logStringtext to add to the log

◆ TpLogWarning()

void TilePlus.TpLib.TpLogWarning ( string logString)
static

Simpler Log for warning messages.

Parameters
logStringtext to add to the log

◆ WhenAll() [1/2]

async Awaitable TilePlus.TpLib.WhenAll ( List< Awaitable > awaitables)
static

Helper method to have WaitAll for Awaitable.

Parameters
awaitables

H/T https://github.com/timo-sisus/awaitable-utility/blob/main/AwaitableUtility.

◆ WhenAll() [2/2]

async Awaitable< bool > TilePlus.TpLib.WhenAll ( List< Awaitable< bool > > awaitables)
static

Helper method to have WaitAll for Awaitable<bool>.

Parameters
awaitables

H/T https://github.com/timo-sisus/awaitable-utility/blob/main/AwaitableUtility. Modified for Awaitable<bool>

Member Data Documentation

◆ GuidDictInitialSize

const int TilePlus.TpLib.GuidDictInitialSize = 64
static

The initialization size for the GUID-to-tile Dictionary.

◆ MaxClonesInitialValue

const uint TilePlus.TpLib.MaxClonesInitialValue = 32
static

Initial value for maximum number of Clonings per update.

◆ MaxDeferredCallbackInitialValue

const uint TilePlus.TpLib.MaxDeferredCallbackInitialValue = 32
static

Initial value for maximum number of deferred callbacks per update.

◆ PaletteTilemapLayer

const int TilePlus.TpLib.PaletteTilemapLayer = 31
static

A constant that is the same as the Palette tilemap layer.

◆ PoolNewItemSize_Dict_V3I_Tpb

const int TilePlus.TpLib.PoolNewItemSize_Dict_V3I_Tpb = 4
static

Size of Dictionaries (Vector3Int=to=TilePlusBase) when new ones are created in the pool.

◆ PoolNewItemSize_List_Tpb

const int TilePlus.TpLib.PoolNewItemSize_List_Tpb = 8
static

Size of Lists of TilePlusBase when new ones are created in the pool.

◆ ReservedTag

const string TilePlus.TpLib.ReservedTag = "------"
static

This tag can't be used by users.

◆ S_OnResetPlayerLoop

? Func<bool> TilePlus.TpLib.S_OnResetPlayerLoop
static

Callback for optional custom takedown of player loop. Occurs before any effect on PlayerLoop. If Func returns true then it's assumed that the Func did it's own work and no other action is needed. If it returns false then the PlayerLoop is set to the default Unity player loop (which would overwrite any actions taken in the Func)..

◆ startTime

double TilePlus.TpLib.startTime
static

Get the Start and Requeue times for an ID.

Parameters
idprocess ID
Returns
(startTime, requeue time) or (0,0) if not found.

◆ TilemapAndTagDictsInitSize

const int TilePlus.TpLib.TilemapAndTagDictsInitSize = 128
static

The initialization size for certain dicts.

◆ TypesInitSize

const int TilePlus.TpLib.TypesInitSize = 16
static

The initialization size for certain dicts.

Property Documentation

◆ BestFrameRate

int TilePlus.TpLib.BestFrameRate = 0
staticget

Best frame rate for current Run session.

◆ CloneOrRefreshBusy

bool TilePlus.TpLib.CloneOrRefreshBusy
staticget

True if tiles are waiting to clone or refresh.

◆ CloneQueueDepth

int TilePlus.TpLib.CloneQueueDepth
staticget

For statistics. Observable in SysInfo window.

◆ CloneQueueMaxDepth

int TilePlus.TpLib.CloneQueueMaxDepth
staticget

For statistics. Observable in SysInfo window.

◆ CurrentActiveDelayedCallbacks

int TilePlus.TpLib.CurrentActiveDelayedCallbacks
staticget

How many active delayed callbacks.

◆ DeferredQueueDepth

int TilePlus.TpLib.DeferredQueueDepth
staticget

For statistics. Observable in SysInfo window.

◆ DeferredQueueMaxDepth

int TilePlus.TpLib.DeferredQueueMaxDepth
staticget

For statistics. Observable in SysInfo window.

◆ FrameRate

float TilePlus.TpLib.FrameRate
staticget

publicly-accesssible frame rate.

◆ FrameRateFail

bool TilePlus.TpLib.FrameRateFail
staticget

Set true when frame rate is lower than the target.

◆ GetAllTagsInDb

IEnumerable<string> TilePlus.TpLib.GetAllTagsInDb
staticget

Get all tags.

Returns
an array of strings with the tags or null if there aren't any.

◆ GetAllTilesRaw

Dictionary<Guid, TilePlusBase>.ValueCollection TilePlus.TpLib.GetAllTilesRaw
staticget

Get all tiles. Note: uses GuidToTile dictionary's Values.

◆ GetDelayedCallbackStates

List<string> TilePlus.TpLib.GetDelayedCallbackStates
staticget

Get a list of all ToString from the delayed callbacks. Not for use in an update loop @ runtime aside from debugging. Used by SystemInfo window's Dump button.

◆ GuidToTileCount

int TilePlus.TpLib.GuidToTileCount
staticget

Number of GUIDs.

◆ InhibitOnTpLibChanged

bool TilePlus.TpLib.InhibitOnTpLibChanged
staticgetset

Inhibits OnTpLibChangedEvents:

◆ InhibitTilemapCallbacks

bool TilePlus.TpLib.InhibitTilemapCallbacks
staticgetset

Inhibits tilemap callbacks (OnTilemapPositionChanged, OntilemapTileChanged). Useful if you're doing a lot of Tilemap operations but don't want the system to handle these callbacks. Note that the internal DBs of TpLib will be incorrect; use SceneScan afterwards. That's not automatic!! The effect of this property isn't the same as InhibitOnTpLibChanged which just inhibits the callback. InhibitTilemapCallbacks causes the tilemap callbacks (OnTilemapPositionChanged, OntilemapTileChanged) to immediately return.

◆ IsPlayMode

bool TilePlus.TpLib.IsPlayMode
staticget

In-Editor, returns true if EditorApplication.isPlayingOrWillChangePlaymode is true. In a built app this always returns true. One would expect the compiler to removed this method when it optimizes in an non-editor build.

true in play mode

always returns TRUE in a built application

◆ IsSceneScanActive

bool TilePlus.TpLib.IsSceneScanActive
staticget

Property to determine if a scene scan is in progress.

true if scene scan active; otherwise, false.

◆ LargestPosChangedCount

int TilePlus.TpLib.LargestPosChangedCount
staticget

For statistics. Observable in SysInfo window.

◆ LargestSyncTileCount

int TilePlus.TpLib.LargestSyncTileCount
staticget

For statistics. Observable in SysInfo window.

◆ MaxNumClonesPerUpdate

uint TilePlus.TpLib.MaxNumClonesPerUpdate
staticgetset

Set the maximum number of tile clones that can occur on one TpLibUpdate. Note that if you set this to zero or LT 0 then the value used is uint.maxvalue which is a pretty big number. This value should be relatively small, but the exact value is app-dependent. If you never place TPT tiles in a running game then this can be ignored. A too-small value will increase the delay from when a TPT tile is painted to when it is cloned. That can affect the appearance of animated tiles.

◆ MaxNumDeferredCallbacksPerUpdate

uint TilePlus.TpLib.MaxNumDeferredCallbacksPerUpdate
staticgetset

Set the maximum number of deferred callbacks that can occur on one TpLibUpdate. Note that if you set this to zero or LT 0 then the value used is long.maxvalue which is a pretty big number. This value should be relatively small, but the exact value is app-dependent.

◆ MemAllocSettings

? TpLibMemAlloc TilePlus.TpLib.MemAllocSettings
staticget

Get the current memory allocation settings for TpLib.

◆ NonTppTilesAddedOrModified

List<Vector3Int> TilePlus.TpLib.NonTppTilesAddedOrModified
staticget

A list of non tileplus tiles that were added or modified.

◆ OptionalGuidToTileMapping

? Dictionary<Guid, TilePlusBase> TilePlus.TpLib.OptionalGuidToTileMapping
staticgetset

Allows accessing the optional Guid maps. See GetTilePlusBaseFromGuid variants.

◆ PauseTpLibUpdate

bool TilePlus.TpLib.PauseTpLibUpdate
staticgetset

Set this TRUE to stop all updating in TpLibUpdate. This stops all tweening, callbacks, tile cloning, etc.

◆ RefreshQueueDepth

int TilePlus.TpLib.RefreshQueueDepth
staticget

For statistics. Observable in SysInfo window.

◆ RefreshQueueMaxDepth

int TilePlus.TpLib.RefreshQueueMaxDepth
staticget

For statistics. Observable in SysInfo window.

◆ RefreshQueuePerUpdate

int TilePlus.TpLib.RefreshQueuePerUpdate = 32
staticget

For statistics. Observable in SysInfo window.

◆ ShortVersionInformation

string TilePlus.TpLib.ShortVersionInformation
staticget

Get a string with abbreviated version information.

◆ TaggedTilesCount

int TilePlus.TpLib.TaggedTilesCount
staticget

Number of different tags.

◆ TargetFrameRate

float TilePlus.TpLib.TargetFrameRate = 60
staticgetset

Target frame rate for current Run session.

◆ TargetFrameRateMet

bool TilePlus.TpLib.TargetFrameRateMet
staticget

Is the target frame rate met?

◆ TileInterfacesCount

int TilePlus.TpLib.TileInterfacesCount
staticget

Number of interfaces.

◆ TilemapsCount

int TilePlus.TpLib.TilemapsCount
staticget

How many tilemaps are being tracked.

The tilemaps count.

◆ TileTypesCount

int TilePlus.TpLib.TileTypesCount
staticget

Number of different Types.

◆ TpLibIsInitialized

bool TilePlus.TpLib.TpLibIsInitialized
staticget

Returns true if the TpLib is ready to access. Cloning queue is examined to ensure no delayed registrations.

true if TpLib has been initialized]; otherwise, false.

◆ UpdateLoopCount

ulong TilePlus.TpLib.UpdateLoopCount
staticget

TpLibUpdate loop count, for diags.

◆ UpdateLoopRunning

bool TilePlus.TpLib.UpdateLoopRunning
staticget

True if the internal update loop is running.

◆ UsingPlayerLoop

bool TilePlus.TpLib.UsingPlayerLoop
staticget

Is the Tp update pump using the Player loop?

◆ VersionInformation

string TilePlus.TpLib.VersionInformation
staticget

Get a string with Name, Version, Build Timestamp.

◆ WorstFrameRate

int TilePlus.TpLib.WorstFrameRate = 500000
staticget

Worst frame rate for current Run session.

Event Documentation

◆ OnTilemapPositionsChangedHook

? Action<Tilemap, NativeArray<Vector3Int> > TilePlus.TpLib.OnTilemapPositionsChangedHook
static

If you want to subscribe to Tilemap.tilemapPositionsChanged use this event instead. The handler for this event in TpLib will also invoke these; its more efficient. Note that this is not always invoked, see if it is appropriate for your use. Note: don't use for monobehaviours or tiles.

◆ OnTilemapTileChangedHook

? Action<Tilemap, Tilemap.SyncTile[]> TilePlus.TpLib.OnTilemapTileChangedHook
static

If you want to subscribe to Tilemap.tilemapTileChanged use this event instead. The handler for this event in TpLib will also invoke these; its more efficient. Note that this is not always invoked, see if it is appropriate for your use. Note: don't use for monobehaviours or tiles.

◆ OnTpLibChanged

? Action<TpLibChangeType, bool, Vector3Int, Tilemap?> TilePlus.TpLib.OnTpLibChanged
static

Event when the TpLib changes due to an addition or deletion. NOTE that this event is NOT cleared when a scene loads or unloads, so if you have anything that could be deleted on a scene (un)load, be sure to use OnEnable and OnDisable to add and remove your callback target. ChangeType, bool is false for single tiles, true if this is part of a group of changes, Position, map.


The documentation for this class was generated from the following files:
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/Editor/TpLibEditorUtils.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLib.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLibData.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLibPools.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLibTasks.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLibTiming.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLibDataAccess.cs
  • /Users/jms/Documents/Tpt_55/TPT55/Assets/Plugins/TilePlus/Runtime/StaticLib/TpLib/TpLibScene.cs