- Home /
Problems with the Trigger Collider (randomly fictional)
I have used void OnTriggerEnter (Collider col) multiple times { If (col.gameObject.tag == "tag") {
within my script, but it only gives the desired result sometimes: inside the game there are no random variables, when the player collides with an object (for example a weapon) I want it to perform a certain sequence of actions. The script is correct and does not give problems in the terminal, when you try to start the game, it only works sometimes, when it doesn't work, you need to restart the scene multiple times (without changing anything from script or unity) to make it work . I noticed that exiting the game, activating and deactivating the collider manually (even without modifying it) increases the chances that the script will work on subsequent execution. Any ideas on how to make it work at first?
Answer by HappyPixel27 · Jul 06, 2020 at 11:40 PM
If the person goes too fast, the script might not be able to update fast enough.