com.mitay-walle.extendable-tile

control color, sprite, transform, with optional modules

MIT License

Stars
1
Committers
1

Extendable Tile

control Unity Tilmap Tile's Color, Sprite, Transform, with optional modules - TileExtensions

Like it? Buy me a candy

If you like my work, you can support me on Patreon

Navigation

Problem

Existing tilemap tiles are rigid realizations with:

  • lack of basic features ( color, transform, sprite manipulations ) which are allowed by TileData / AnimatedTileData
  • feature set of any Tile is fixed, no customization / optional modules, that have to add repeatatively byself
  • lack of Inspector Undo
  • Replace Tile type is big issue (change from RuleTile to TerrainTile etc )
  • lack of Copy / Paste
  • Rigid custom Inspectors, disallowing use Odin, or built-in Range / Header / Space Attributes for Inspector customization

Solution

  • SerializeReference to have optional modules
  • no use custom Inspector / PropertyDrawers , to allow Odin, save built-in Undo, Copy / Paste, etc

Demo

Contents

  1. Demo Scene, tiles, extensions
  2. unitypackage to direct import
  3. full source code on Github to explore
  4. if your project contains Odin Inspector - ExpandableTile will use it, if not
  5. TypeToLabelAttribute and custom ContextMenu to comfortable usage
Script types:
  • ExtendableTile - CustomTile, that aggregates TileExtensions
  • TileExtensionSO - ScriptableObject, containing TileExtension, can be referenced from ScriptableObjectEx
TileExtension list:
  1. AnimateSpriteEx - analogue to Animated Tile
  2. WeightRandomSpriteEx - analogue to Weight Random Tile
  3. TerrainEx analogue to Terrain Tile
  4. PipelineTileEx - analogue to Pipeline Tile
  5. ColorOutlineEx - evaluate Gradeint based on same-tile-neibhours-count, smooth sides
  6. PositionMapEx - Remap tile position with split random MinMaxCurves for X and Y
  7. RandomColorEx - Multiply tile color to MinMaxGradient.Evalute(), has Perlin module
  8. RotateMapEx - Remap tile rotation with random MinMaxCurve for Z
  9. ScaleMapEx - Remap tile localScale with random MinMaxCurve for XYZ
  10. ScriptableObjectEx - refers to TileExtensionSO and execute it's TileExtension

How To

Create Tile or TileExtensionSO?
  • Project Window -> RMB -> Create/2D/Tiles/Extendable Tile / Extension
    alt text
Change type of already created extension in Collection or in TileExtensionSO ?
  • TileExtension property title -> RMB -> set to [Extension]
    alt text

Requriments

  • Unity 2020.2 Array became reordable at this version

Known issues

  • #3 some TileExtensions need Enter / Exit PlayMode to Refresh
  • #4 at this moment position rerandomized after any changes in any listed ExtendableTile.Extensions
  • #5 ⛔ Error log 'Use RegisterCompleteObjectUndo' - not braking anything
  • #6 ⛔ MinMaxGradient dropdown almost not clickable - problem in Unity own realization, if you use Odin - it works fine, either you write own CustomPropertyDrawer, or you can switch Inspector to Debug mode, and switch gradient-type there

Planned

  • #3 RefreshTile() Implementation
  • #4 Seed-based Randomization
  • #2 SiblingRuleEx (Existing Rule Tile has rigid Inspector, i've ported it to PropertyDrawer for RuleEx, but it's not ready-to-use)
Related Projects