Bug with layers? Need help

As I was expanding my sanbox I introduced another layer: Wall. Obviously I want this layer on wall. You wouldn’t have guessed this. So now my problem is that somehow nothing happens at all with this layer. I added the code everywhere needed: in Utility in the Layer Enum, in the switch statements in PlayerMovement.cs and CursorAffordance.cs, in the Layer[] in CameraRaycaster.cs. When I set the layer of a wall element to Wall still nothing happens and gets treated as a walkable, if I set the same object to enemy than it works like an enemy.

I have no clue why. Please help.

Hi Martin,

From memory the layers array is visible in the Inspector, the order of these layer priorities matter, it may not be the issue but can you pop a screenshot up of the Inspector so I can see the order you have them in.


I hope you were thinking about this:



Nope, it’s the array of layers that you have exposed in one of your scripts, I think it might be CameraRaycaster.cs.



I hope I got it this time. Thanks a lot for helping!

Getting closer - that’s the script.

Select the GameObject that is attached to, then in the Inspector the current order of the layer priorities will be displayed.

I see the problem now. Adding my Wall layer to the Layer array in visual studio didn’t update the component:


there should be an Element 2 Wall I guess?

1 Like

Yep managed to fix it myself now:


It works fine now, thanks for the tip!

1 Like

Well done, you may also need to put the enemy at the top of that least, from the perspective of priorities.

Glad you can move forward again :slight_smile:

Privacy & Terms