#ConnectedClients Error

1 messages · Page 1 of 1 (latest)

pastel roost
#

is there a reason you're adding the listener through code? And a reason why you're doing it on scene load?

#

I would just drag and drop UpdateStartButton in the inspector, and just not show the Start Button for clients in the first place

#

Avoids having to do most of this logic in the first place

edgy stump
#

if you go to a new scene and then come back the inspector gets wiped

#

and or probably causes error saying this has been destoryed but still trying to access, its been a month or two since i switched so i forget all the exact problems

pastel roost
pastel roost
edgy stump
#

so i just made it (!NetworkManager.Singleton.IsServer) return; instead

#

and it works no error now

#

so i guess what does that tell me?

pastel roost
#

Odd

#

GameManager is a NetworkBehaviour, right?

edgy stump
pastel roost
#

Yeah, weird.

#

My guess would be that it has to be something to do with performing this in OnSceneLoaded

#

Something not being initialized yet.

edgy stump
#

i think youre right, ill keep digging and let you know what i find, thanks!

edgy stump
#

one sec

pastel roost
#

Maybe, but hard to tell.

#

Looks like you have leaks involving PlayerData

edgy stump
#
 public struct PlayerData : IEquatable<PlayerData>, INetworkSerializable
{
  
    public ulong clientId;
    public Color color;
    public int eyesIndex;
    public int mouthIndex;
    public FixedString64Bytes username;

    public bool Equals(PlayerData other)
    {
        return clientId == other.clientId && username == other.username && color == other.color && eyesIndex == other.eyesIndex && mouthIndex == other.mouthIndex;     
        
    }

    public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
    {
        serializer.SerializeValue(ref clientId);
        serializer.SerializeValue(ref username);
        serializer.SerializeValue(ref color);
        serializer.SerializeValue(ref eyesIndex);
        serializer.SerializeValue(ref mouthIndex);

        
    }
}```
edgy stump
#

the issue was the memory leak causing everything to stop working, and the memory leak was due to the fact i wasnt using networkmanagers on destroy but just regular ondestroy.

so it was never disposing of my network list. Causing errors and hold ups and leaks

#

@pastel roost