At the first time, my player didn’t move anywhere but already get 1 hit.
I don’t know is it the player touch the floor?
My player can get 1 hit for touching the wall.
how can I fix it? thank you very much!
Hi Holyjosh,
Welcome to our community!
I don’t know is it the player touch the floor?
Yes, the 1 hit could be caused by the floor. Our code increments hits
whenever the player collides with another collider. There is no restriction (yet).
A quick fix would be:
private void OnCollisionEnter(Collision other)
{
if (other.gameObject.name == "Plane") { return; }
// your code where you increment the hits
}
return;
terminates the method immediately.
Did this fix it?
See also:
- Forum User Guides : How to mark a topic as solved
2 Likes
Yes, I fixed it!
Nina, very grateful for your help!
1 Like
You’re welcome.
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.