From f19d2e841538ab85b94b4e6a456044f1cd8850d2 Mon Sep 17 00:00:00 2001 From: Joel <62071362+JoelCreatesGames@users.noreply.github.com> Date: Wed, 9 Feb 2022 20:56:35 -0400 Subject: [PATCH 1/2] Add Layer comparison example to README --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 820b502..7af4a43 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Once you have generated one or more through the menu, you will see the files app ![alt](./Documentation~/generated_files.png) To use the generated files you simply access them through their classes which are: Tags, Layers, and SortingLayers. -Below is an example of a use case for the Tags. +Below is an example for Layer and Tag comparison. ```c# public class Foo : MonoBehaviour @@ -49,8 +49,13 @@ public class Foo : MonoBehaviour { if (other.transform.CompareTag(Tags.PLAYER)) { - ... + // Tag } + + if (Layers.ENEMY_MASK & (1 << other.gameObject.layer)) > 0) + { + // Layer + } } } ``` From 519b4b81059395e130c4668e8214f19c34d45d1f Mon Sep 17 00:00:00 2001 From: Joel <62071362+JoelCreatesGames@users.noreply.github.com> Date: Wed, 9 Feb 2022 20:59:05 -0400 Subject: [PATCH 2/2] Change to player mask for consistency --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7af4a43..0da1df8 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ public class Foo : MonoBehaviour // Tag } - if (Layers.ENEMY_MASK & (1 << other.gameObject.layer)) > 0) + if (Layers.PLAYER_MASK & (1 << other.gameObject.layer)) > 0) { // Layer }