floatinghotpot / socket.io-unity

socket.io client for Unity, power game client with node.js back-end
494 stars 75 forks source link

Deleting and recreating a GameObject after it has registered it's listeners #23

Open tomasnormand opened 6 years ago

tomasnormand commented 6 years ago

So I have a game object that is created for handling the lobby chat. On Start it does DoOpen to set up the socket.on callbacks. If I leave the scene (so it gets destroyed) and then go back. The reference to the object is being stored somewhere and still receives the callbacks even though the gameobject itself has been destroyed. Is there a way to NOT cache the object reference or to remove the object form the list of listeners and re create them?

usmanakram commented 4 years ago

You should call "DoClose" method to close connection.