Basics
In most cases, the class that you want to subclass is TilePlusBase. But you might want to extend from one of the supplied tiles like TpFlexAnimatedTile. Many TilePlus Tiles’ fields, properties, and methods are marked as ‘virtual’ so they can easily be overridden.
When creating subclasses of TilePlus tiles you should specify a namespace. Use Tools/TilePlus/Configuration Editor and add your namespace to the Namespaces field. Then click the Reload button. Namespaces are required for derived TilePlus classes. If the namespace isn’t added to the system via the Configuration Editor, then the Selection and Brush inspectors will not display any fields or properties that you’ve decorated with TilePlus attributes.
Many of the properties in the sections demarked by #if UNITY_EDITOR are things that you can ignore. If you want fields or properties to display in the Tile+Brush Inspector, you can use attributes to display them. The TilePlusBase property “Description” can be used to show some text information about your tile in the Tile+Brush inspector.
It’s helpful to examine the ITilePlus interface as it’s not cluttered up with code, tooltips, attributes, conditional compilation directives, and so on.
Namespaces
The GUI formatter for the Brush and Selection inspectors displays information in class-hierarchical order. But it needs to know what not to display, otherwise it will breeze through the class hierarchy all the way to UnityEngine.Object.
Therefore, by default it ignores anything outside of specific namespaces. The TilePlus namespace is hard-coded in.
The configuration editor has a Namespaces text field where you can provide a comma-delimited list of namespaces to use. The default for that text field includes TilePlusDemo.
When creating your own tile classes, place the namespace that you’re using in this list. Don’t forget commas! Note that if you add a namespace, attributes are still required to display information.
For example, if you were to add the UnityEngine.Tilemaps.Tile namespace then the TilePlusBase’ base class of Tile would not appear in a foldout.
Please click the Reload button in the configuration editor when you change this. Also, be aware that if you click “Reset To Defaults” that you’ll need to re-add the namespaces!
Interfaces
ITilePlus specifies several properties and a few methods that are common to all tiles subclassed from TilePlusBase since that class implements everything in the interface.
Please note that any subclasses of TilePlusBase using ITilePlus properties with default members need to specify the interface to ‘override’ the defaults. This can be seen in the tiles which support simulation (TpSlideShow, TpAnimatedTile, and TpFlexAnimatedTile).
ITpPersistence specifies properties required for tiles using TpLib’s save/restore framework.
ITpMessaging specifies properties required for tiles using TpLib’s two-way messaging framework.
ITpSpawnUtilClient specifies properties required for tiles which spawn prefabs or paint tiles when using the SpawningUtil library methods.
ITpMessaging and ITpPersistence are the interfaces you’ll most likely implement if creating your own tiles and you want to use TpLib’s messaging and save/restore frameworks. If you don’t want to use those then you can ignore those interfaces.