- Home /
Layermask for OnTriggerStay() not working...
I have this code for a pickup script and the filter doesn't register anything. If I take away the filter the script works. So that's not the issue. Any help is appreciated.
My code:
void OnTriggerStay(Collider Player) {
// If the player is the colliding object.
if(Player.CompareTag("Player")) {
// You're standing near the object.
StandingNearObject = true;
}
}
Answer by Bunny83 · May 08, 2017 at 11:27 PM
Uhm your question is confusing. In the title you talk about a "Layermask" but in your code you don't use any layer or layermask. All you do is checking the object tag value.
So either you want to "tag" your object with the tag "Player", or if you want to check the layer of the object you have to test the objects layer value
Your answer
Follow this Question
Related Questions
How to make a drag/drop script only affect objects with a tag? 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Use a #if statement to check if a script exists in project? 0 Answers
C# the position of the object 1 Answer