I’m trying to implement a Lock/Unlock system in my project.
As you can see in the image, I’ve set up a Box Collision to control the Lock/Unlock functionality. The goal is to allow only the characters inside the box to perform the Lock/Unlock action.
The system works fine when a character inside the box tries to Lock/Unlock. However, the problem arises when a character outside the box can also trigger the Lock/Unlock action. This happens because there is already a character inside the box, and the condition always evaluates to True
.
What I want to achieve is:
- Only the characters inside the Box Collision should be able to perform the Lock/Unlock action.
- Characters outside the box should not be able to trigger this functionality.
Could you please suggest a few ideas on how to implement this correctly? Thank you!