I use a float SyncList to sync some attributes (health, stamina, ect) from the server to clients and sometimes the value is not synced to the client. I use a struct SyncList for an inventory from server to client and about 20% of the time this does not sync either.
I have tried with and without the hook callback. I have tried manually setting the index to dirty. I have tried reliable and unreliable state update channels. Nothing seems to make a difference.
What I am attempting seems simple and the code is not complex. Is this a UNET bug? Has anyone worked around it successfully? This is on 5.3.4.
With limited testing if I mark the indexes dirty every frame it doesn’t seem to miss an update on the client. Of course this is a waste of bandwidth.
For a work around I will try setting the dirty flag for multiple frames if a change occurs on the server through a coroutine but not every frame. Hope this is fixed soon.
I had the same problem, or at least i think i had. I finally was able to fix this. I do not know if this is what you are looking for? I had a lot of struggle to get this going.
There is a bug where SyncVar/SyncList hooks/callbacks will not always work if changed around a scene transition. The SyncList values will be set correctly, but callback will not be invoked. https://fogbugz.unity3d.com/default.asp?833578_76432msnc8da1g6k
Also structs must be immutable. You should never change field values within the struct because this will not flag dirtyBits or invoke callbacks. No errors will be thrown, but it won’t work. I believe must generate a completely new struct and assign it.