UCC 2.1.8 + MP: Networked Interaction Failures - PUN Interactable

landwaster

New member
For clarification of all of the below, I want the door to either stay completely open or closed until interacted with again by any player. Not auto-swing closed on its own.

1. Ultimate Character Controller + PUN MP Addon

2. Unity version: 2019.2.11f1 HDRP

3. Bug description:

I used the opsive pun addon wizard to setup the multiplayer scene. I can run around in it with friends with a prefab character. Then I made an oven, with a door and I animated the door in blender. Then I set up a trigger collider + ability start location + interactable (id = 2, targets: oven (animated interactable)) on an oven interactable gameobject, and on my player prefab an interact ability set up for manual button down targeting interactable id 2 w/ object detection = trigger, inspector id = open oven, ability message text = press F to use oven. On the oven I have a mecanim animator set up that correctly opens/closes the door when a bool is changed IsOpened. Playing by myself this opens and closes the door. When I connect a second player however it sometimes works and sometimes doesn't on one or the other side.

Only one of the clients is able to open and close the oven door on every connection. If that player interacts then it does change on all the clients. But, if any of the other clients try it doesn't and if the other clients who can't update all the clients do try, then the state of the door gets messed up. Which can make it seem like the messages aren't being sent properly, but really it's that the state is out of whack.

I noticed on one client. If i open the door it sends the true of the door being open. However, the other client if it attempts to open the door causes it to not open locally but it does open remotely on the other client and I hear two clicks of the door opening and closing immediately and see the Boolean go from true for open back to false immediately. But, only on the one client. However, the other client doesn't have this problem. It's almost like one of the clients is rebroadcasting the event back to the client that sent it again, and it's a kind of reflection echo.

I think the reason no one sees this on the interactable door in the demo room is that it uses an animator that instead of being in a Boolean state, triggers an open that closes again after 2 seconds automatically so there is no concept of open/close states. And, that delay effectively debounces the multiple echo messages for opening because it's already in its triggered state with a wait time to transition back.

Thoughts?

Edit 1:
In Interactable.cs I'm trying to understand how just querying CanInteract would stop multiple events of the same interaction. It wouldn't...

8c25987ab5f7ede8689efea45483838f.png


I think the comment there was meant as a // TODO

In the case of animated interactables, if m_SingleInteract is not set true, which is desirable with doors for example, then CanInteract always returns True regardless if it has been interacted with or not. So, this is not a way to handle ignoring multiple incoming remote events for an already processed local event causing the bool to toggle over and over.

Edit 2: Even after solving that by putting in an artificial delay before allowing further handling of any incoming messages I still encounter issues where the state is only being updated by one side and not the other.


822ed5498938ef25738a3fa6c8e71787.png


9a0f44d307beff89dc8faca52a8b5577.png



ebe395ad7ab16e07b2d2677c05f4e272.png
 
Last edited:
Are you able to tell me what I need to change within the PUN demo scene in order to reproduce it? I'll need to look closer into it.
 
Top