Skip to content

Commit

Permalink
Fixed issues with builds due to UnityEditor being used during Runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
skner-dev committed Dec 11, 2024
1 parent f6e0dc0 commit 6cb3ad7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Runtime/Components/DualGridTilemapModule.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using skner.DualGrid.Extensions;
using skner.DualGrid.Utils;
using System;
using UnityEditor;
using UnityEngine;
using UnityEngine.Tilemaps;

Expand Down Expand Up @@ -73,8 +72,9 @@ internal void HandleTilemapChange(Tilemap tilemap, Tilemap.SyncTile[] tileChange
Debug.LogError($"Cannot update render tilemap, because tile is not set in dual grid module.", RenderTilemap);
return;
}

Undo.RecordObject(RenderTilemap, $"Updated {tileChanges.Length} render tile(s)");
#if UNITY_EDITOR
UnityEditor.Undo.RecordObject(RenderTilemap, $"Updated {tileChanges.Length} render tile(s)");
#endif

foreach (Tilemap.SyncTile tileChange in tileChanges)
{
Expand All @@ -93,8 +93,9 @@ internal void RefreshRenderTiles()
Debug.LogError($"Cannot refresh render tilemap, because tile is not set in dual grid module.", RenderTilemap);
return;
}

Undo.RecordObject(RenderTilemap, "Refreshed render tiles");
#if UNITY_EDITOR
UnityEditor.Undo.RecordObject(RenderTilemap, "Refreshed render tiles");
#endif

RenderTilemap.ClearAllTiles();
foreach (var position in DataTilemap.cellBounds.allPositionsWithin)
Expand Down

0 comments on commit 6cb3ad7

Please sign in to comment.