if the tile is bigger then a normal tile and it looks like it is then make it two tiles and put each part on its own layer and then you can control the position of each part…
her is a split brush editor that draws and erases two tiles at once each on different layers and offsets
using UnityEditor;
namespace UnityEngine.Tilemaps
{
[CreateAssetMenu]
[CustomGridBrush(false, true, false, "Split Brush")]
public class SplitBrush : GridBrush
{
public TileBase Back;
public string BackName = "Back";
public Tilemap BackTilemap;
public Vector2Int BackOffset;
public TileBase Fore;
public string ForeName = "Fore";
public Tilemap ForeTilemap;
public Vector2Int ForeOffset;
public override void Paint(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
{
if (BackTilemap != null && ForeTilemap != null)
{
var bp = new Vector3Int(position.x + BackOffset.x, position.y + BackOffset.y, position.z);
BackTilemap.SetTile(bp, Back);
BackTilemap.SetTransformMatrix(bp, Matrix4x4.identity);
var fp = new Vector3Int(position.x + ForeOffset.x, position.y + ForeOffset.y, position.z);
ForeTilemap.SetTile(fp, Fore);
ForeTilemap.SetTransformMatrix(fp, Matrix4x4.identity);
}
}
public override void Erase(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
{
if (BackTilemap != null && ForeTilemap != null)
{
var bp = new Vector3Int(position.x + BackOffset.x, position.y + BackOffset.y, position.z);
BackTilemap.SetTile(bp, null);
BackTilemap.SetTransformMatrix(bp, Matrix4x4.identity);
var fp = new Vector3Int(position.x + ForeOffset.x, position.y + ForeOffset.y, position.z);
ForeTilemap.SetTile(fp, null);
ForeTilemap.SetTransformMatrix(fp, Matrix4x4.identity);
}
}
}
}
using System.Linq;
using UnityEngine;
using UnityEngine.Tilemaps;
namespace UnityEditor
{
[CustomEditor(typeof(SplitBrush))]
public class SplitBrushEditor : GridBrushInspector
{
private SplitBrush Brush => target as SplitBrush;
public override void PaintPreview(GridLayout gridLayout, GameObject brushTarget, Vector3Int position)
{
var b = Brush;
var maps = brushTarget?.transform.parent.GetComponentsInChildren<Tilemap>();
for (var i = 0; i < maps.Length; i++)
{
var map = maps[i];
var name = map.name;
if (name == b.BackName)
{
var p = new Vector3Int(position.x + b.BackOffset.x, position.y + b.BackOffset.y, position.z);
map.SetEditorPreviewTile(p, b.Back);
map.SetEditorPreviewTransformMatrix(p, Matrix4x4.identity);
b.BackTilemap = map;
}
else if (name == b.ForeName)
{
var p = new Vector3Int(position.x + b.ForeOffset.x, position.y + b.ForeOffset.y, position.z);
map.SetEditorPreviewTile(p, b.Fore);
map.SetEditorPreviewTransformMatrix(p, Matrix4x4.identity);
b.ForeTilemap = map;
}
}
}
public override void ClearPreview()
{
var b = Brush;
if (b != null)
{
if (b.BackTilemap != null)
b.BackTilemap.ClearAllEditorPreviewTiles();
if (b.ForeTilemap != null)
b.ForeTilemap.ClearAllEditorPreviewTiles();
}
}
public override GameObject[] validTargets
{
get
{
var brush = Brush;
var list = from map in GameObject.FindObjectsOfType<Tilemap>()
where (map.gameObject.name == brush.BackName) || (map.gameObject.name == brush.ForeName)
select map.gameObject;
return list.ToArray();
}
}
}
}