Open rygo6 opened 4 years ago
The comment is out of date, the methods are correctly private
, we do not support anymore manual init outside OnEnable
/OnDisable
, this was overly complex and partially broken, without any sensible way to fix. You do not need to do anything other than enable the component to initialize it and disable it to clean it up. I think you shouldn't need anything else to restart the connection than just do some:
pc.enabled = false;
pc.enabled = true;
@fibann has been recently working on this, including peer connection restart, and might shed more light on it, and/or correct me.
Thank you. That will work. A restart method would be probably be useful.
So I noticed in the code here: https://github.com/microsoft/MixedReality-WebRTC/blob/9d1b34cd2047c876fc5af250417114f450865b6b/libs/unity/library/Runtime/Scripts/PeerConnection.cs#L263
It says:
This implies to me there should be a serialized bool to enable/disable the auto calling of this method and that this method should be public. But the method is not public, and there is no way to enable/disable it from being called OnEnable.
Is this comment out of date? Or representative of an expected change? Because I actually need this functionality right now, for the purpose of restarting a PeerConnection.
Right now I assume I should make
InitializeAsync
andUninitialize
public. Add in a bool to disableInitializeAsync
from being auto called from OnEnable. Then if I calledUninitialize
followed byInitializeAsync
it should reset the PeerConnection and start a new one. Is that a correct assumption?