Skip to content

Commit

Permalink
Use CompositeOperation only in Unity 2022_1 or newer
Browse files Browse the repository at this point in the history
  • Loading branch information
OndrejNepozitek committed Feb 16, 2024
1 parent 4c2380b commit bbe7f70
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public override void Run(DungeonGeneratorLevelGrid2D level)
private void AddFloorCollider(GameObject floor)
{
var tilemapCollider2D = floor.AddComponent<TilemapCollider2D>();
#if UNITY_2021_3
#if UNITY_2022_1_OR_NEWER
tilemapCollider2D.compositeOperation = Collider2D.CompositeOperation.Merge;
#else
tilemapCollider2D.usedByComposite = true;
Expand Down
2 changes: 1 addition & 1 deletion Examples/Grid2D/Resources/Docs/CurrentRoomDetection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override void Run(DungeonGeneratorLevelGrid2D level)
private void AddFloorCollider(GameObject floor)
{
var tilemapCollider2D = floor.AddComponent<TilemapCollider2D>();
#if UNITY_2021_3
#if UNITY_2022_1_OR_NEWER
tilemapCollider2D.compositeOperation = Collider2D.CompositeOperation.Merge;
#else
tilemapCollider2D.usedByComposite = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected GameObject CreateTilemapGameObject(string name, GameObject parentObjec
protected void AddCompositeCollider(GameObject tilemapGameObject, bool isTrigger = false)
{
var tilemapCollider2D = tilemapGameObject.AddComponent<TilemapCollider2D>();
#if UNITY_2021_3
#if UNITY_2022_1_OR_NEWER
tilemapCollider2D.compositeOperation = Collider2D.CompositeOperation.Merge;
#else
tilemapCollider2D.usedByComposite = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected GameObject CreateTilemapGameObject(string name, GameObject parentObjec
protected void AddCompositeCollider(GameObject gameObject)
{
var tilemapCollider2D = gameObject.AddComponent<TilemapCollider2D>();
#if UNITY_2021_3
#if UNITY_2022_1_OR_NEWER
tilemapCollider2D.compositeOperation = Collider2D.CompositeOperation.Merge;
#else
tilemapCollider2D.usedByComposite = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected GameObject CreateTilemapGameObject(string name, GameObject parentObjec
protected void AddCompositeCollider(GameObject gameObject)
{
var tilemapCollider2D = gameObject.AddComponent<TilemapCollider2D>();
#if UNITY_2021_3
#if UNITY_2022_1_OR_NEWER
tilemapCollider2D.compositeOperation = Collider2D.CompositeOperation.Merge;
#else
tilemapCollider2D.usedByComposite = true;
Expand Down

0 comments on commit bbe7f70

Please sign in to comment.