Interact ability not always triggered

schouffy

New member
I am using the Ultimate Character Controller, version 2.3.5, on Unity 2021.1.15f1
URP

I have setup my character locomotion to use interact ability through raycast (screenshot). I'm not using triggers.
I have a Door prefab that has an Interactable on it.

When I try to open my first door, it works.
Then any time I try to open another door, it doesn't work the first time, but it works the second time.

From my investigations, it seems the m_Interactable is not cleared after the previous door is opened. So when trying to open the next door, the casted item is not the correct door (this check is done in Interact.cs, line 135), so it doesn't open, but then it sets the m_Interactable to null. The next attempt will then set the m_Interactable to the proper, current door and everything will work.

I fixed it by setting the m_Interactable to null in
Code:
Interact.AbilityStopped(bool force) (line 293)
so the interactable is reset after each use.

But I don't think it's the best approach, and this use case is so basic that I can't help but think I did something wrong.

Is this a bug or should I configure something another way ?
 

Attachments

  • character locomotion.png
    character locomotion.png
    67.6 KB · Views: 7
Hmm to be honest this is a potential bug - I can't verify this in the demo scene right now, but will check and if I can repro it I'll let Justin know. Or if you're able to DM me a small repro project that would be useful.
 
Well, when trying to make a repro project, it works perfectly as intended. I still have my issue on my project, so it must be something I do wrong on my side, but I can't figure it out.
Sorry for the noise.
 
No worries, it's easy to change something seemingly minor that ends up causing knock-on effects.
 
Top