Changing Slope Limit Activates Trigger Volume

Hey everyone - I’m getting a really weird bug within my scripts and I was hoping someone could help me out. I’m using a first-person character controller, and the controller starts inside a trigger volume (representing a water volume - you start underwater). I have a script on the controller that allows you to press a button to change certain values on the character controller - among them the “Slope Limit” value. In specific, you start underwater and you can press the “3” button to change your slope limit from 65 to 85.

The weird part is that every time I change the slope limit - even if I’m running the game and just change it via the inspector sidebar rather than pressing a button to activate the script - it activates the “OnTriggerEnter” function for the volume (which happens to play a splash sound effect, which is how I noticed it). Changing any of the other values doesn’t seem to have this effect as far as I can tell, just the Slope Limit. Every time I change it, I get feedback that indicates that I have just entered the trigger volume, even though I never left it.

Any ideas why this is happening and how I stop it?

Reviving 2.5 year old thread since I just spent two days tracking down a bug that turned out to be this. In my case, I didn’t really have to change the slope limit so I was able to remove the code and get the triggers working properly again.

However, I can imagine some gameplay elements where triggers changing slope limits are valid scenarios. I don’t know why the internals of the controller do this and we can only guess without source code.

I’d love to hear Unity’s comments on why this happens so we can better understand the internals of their physics system. At the very least if we can get some information that this happens added to the documentation so another developer doesn’t fall into this trap.

FYI, I’m using a third person controller but the effect is the same.

1 Like

This just happened to me. Im looking for a fix:)

I found a fix:)

I disable the character controller, then change the slope limit, then enable the character controller.

So glad this worked. It was driving me crazy.

1 Like