Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make CollectTilemapSourcesCache2d.cs check exclude unsupported code in pre 2022 versions #228

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion NavMeshComponents/Scripts/CollectTilemapSourcesCache2d.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ protected override void Awake()
base.Awake();
}

#if UNITY_EDITOR || UNITY_2022_2_OR_NEWER
private void OnTilemapTileChanged(Tilemap tilemap, Tilemap.SyncTile[] syncTiles)
{
if (tilemap == _tilemap)
Expand All @@ -51,6 +52,8 @@ private void OnTilemapTileChanged(Tilemap tilemap, Tilemap.SyncTile[] syncTiles)
}
}
}
#endif


public AsyncOperation UpdateNavMesh(NavMeshData data)
{
Expand All @@ -75,14 +78,18 @@ public override void PostCollectSources(NavMeshSurface surface, List<NavMeshBuil
_lookup[position] = i;
}
}
#if UNITY_EDITOR || UNITY_2022_2_OR_NEWER
Tilemap.tilemapTileChanged -= OnTilemapTileChanged;
Tilemap.tilemapTileChanged += OnTilemapTileChanged;
#endif
}

protected override void OnDestroy()
{
#if UNITY_EDITOR || UNITY_2022_2_OR_NEWER
Tilemap.tilemapTileChanged -= OnTilemapTileChanged;
#endif
base.OnDestroy();
}
}
}
}