Hi there! We’ve been experiencing a brutal bug. I’m posting here almost as a matter of flailing helplessly. I have no idea what could be going on and I suspect it’s an engine bug. As you can see from the start(ish) of this video:
a few of our systems are failing at once. Enemies cannot actually “see” the player, and the player’s weapon does not hit the enemies. The weapon is using Linecasts, and the enemies are using Raycasting. These systems are completely independent in my code and this bug will manifest in a wide range of situations, including areas where I can guarantee that no strange colliders exist to block any weirdness.
Another odd bug happens sometimes where players fall through our thick “fall to death” colliders as well as redundancies, causing them to fall forever, and I’m wondering if that’s a related issue. it seems like some part of the physics system is just failing.
Does anyone have any idea what on EARTH could be going on? We’re on 2021.2.7f1.
Since the failures happen when agents are so close together, I’m guessing you are linecasting / raycasting from within the target collider that you are trying to hit. That won’t work, you gotta be outside of it.
As for falling through stuff, perhaps you aren’t moving the Rigidbodies correctly? With Physics (or Physics2D), never manipulate the Transform directly. If you manipulate the Transform directly, you are bypassing the physics system and you can reasonably expect glitching and missed collisions and other physics mayhem.
This means you may not change transform.position, transform.rotation, you may not call transform.Translate(), transform.Rotate() or other such methods, and also transform.localScale is off limits. You also cannot set rigidbody.position or rigidbody.rotation directly. These ALL bypass physics.
Always use the .MovePosition() and .MoveRotation() methods on the Rigidbody (or Rigidbody2D) instance in order to move or rotate things. Doing this keeps the physics system informed about what is going on.
Hey thanks very much for taking the time to offer some thoughts, that’s kind of you. THAT SAID haha - I’m afraid these can’t be the answer.
First of all, all of these issues and mechanics have been stress tested on PC, Switch, PS4, PS5, and all the Xboxes. I think we may have encountered them maybe… one in 200 plays, something like that. Secondly, once this happens, the gameplay state is basically broken until the scenes are reloaded - no swinging weapons works in any capacity, despite it working just fine in those situations prior.
as far as the colliders, I’m not using transform.Translate, don’t worry. In fact, I’m not using Rigidbodies at all. I’m using character colliders for all of this, and moving the character using CharacteCollider.move. and again, the repro on this is so low that personally I have never encountered it. if there was something wrong with how I was building these systems the game would never work in any situation!
With such rarity it might be worth putting in extra instrumentation to help you get more info.
For instance you can capture the user’s intent to attack and also decide if they attacked.
Try making something that correlates these two an as soon as X amount of time happens with the user hitting attack and nothing happening, start capturing some kind of data to return to you via eventing.
At the end of the day it’s probably some little boolean that failed to get cleared. Are you using AnimationEvents? Those can be buggy if you speed up your Time.timeScale… it might be useful to have fallback timeout counters too.
And if you discover a fallback timer expiring and “saving” you , that would be a great thing to report via eventing.