Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.
You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.
That’s odd. IsTouchingLayers returns a bool, not an int. If you placed ||
between the two method calls, that should have worked because the condition was supposed to check if one of the returned values is true.
For the version with the |
, it might be an idea to log the whole expression into your console by with I mean the value you pass on to IsTouchingLayers, not the value returned by IsTouchingLayers. LayerMask.GetMask returns an int.
If you still cannot find any solution, log the name of the layer your player is touching at runtime into your console. Maybe your player does not touch the expected layers. Or maybe a game object was assigned to the wrong layer. Or maybe there is a typo in the ‘Climbing’ layer name in Unity. Take a very close look at the spelling, and check if there are any spaces such as in 'Climbing '.