SyncListStruct When does it Sync and why isn't mine?

So I’ve been having a hard time getting my SyncList Struct to sync. I’ve tried lots of different things and read and reread through the docs but still I can’t seem to get the struct list from any clients to match as it is on the host. Couple of questions.

Does the SyncList.Add() have to be called while a client is connected for the client to see it?

What are the the required components for a SyncList to be synced? Just a network identity? What should be checked?

Finally to describe what I’m trying to do and then show the code (which is messy after my struggle with this).

I’m basically trying to initialize certain game aspects once by the person who hosts via my Game Manger GameObject (meaning every game instance will have one). It has my script and a Network Identity. Player A hosts creates random spawn points which get added to a struct with three floats (x,y,z) that is then turned into a list of vectors that contains the spawn points so I can in effect sync all spawn positions. So every player sees everything in the same place.

At the moment I can only get it to work for the host. No matter what I do I can’t get any clients to see the same list. Here is the code.

http://hastebin.com/fofuluwuju.avrasm

No

What happens if you use Vector3 instead of vPos? Maybe you missed something in your custom vector struct?

Also, here are two useful debugging tools:

  • Add a Network Manager HUD component to the object with your Network Manager. Uncheck Show Runtime GUI, unless you were using that. Run your host in the editor and inspect this component. It will show you connections and objects spawned to them
  • Change your Network Manager>Log Level to Debug. Then it will log all the spawns and lots of other stuff. If you want more, set it to developer. Look at the server logs and client logs.

I can’t use Vector 3 as far as I’m aware. I tried and I think I was getting errors which is why I resorted to my custom struct. If you know of a syntax that should work let me know and I’ll try it out.

Thanks for informing of the network debug logs! I’m not sure what I should be looking for to see if the list being synced to the network. I’ll be digging through the logs though to see if I find anything relevant.

So setting it to developer mode allows me to see a SyncVar I knew was working being posted to console every time its synced. I don’t see anything from my SyncListStruct though. Also I’m pretty sure if you can SyncVar a vector you have to be able to syncList Vectors right?

The docs just say this on SyncListStruct

“The struct used SyncListStruct derived class can contain members of basic types, arrays, and common Unity types. They cannot contain complex classes or generic containers.”

But doesn’t Vector3 fall under complex class/generic container ?

EDIT: So I managed to be able to just use Vector3 in my Struct which is nice. If I try just making a StructList with type of vector3 I just get some generic compiler error telling me to fix my compiler errors with no info as to what those errors are exactly.

Either way nothing is still syncing and no posts are getting sent to server. Its either something with the Game Managers setup or maybe I’m trying to make the list to soon? Would doing it in start be bad? If I make list in start then maybe there is no network connection when the list is being made and hence nothing to sync?

But doing it onClientStart does nothing as well as onServerStart which is why I’ve resorted to just Start. Also my SyncVars don’t seem to have any trouble. So confused.

Edit:

Trying just a basic sync var. That isn’t syncing either. I set a SyncVar of type int, set it equal to 5 if server. Player 1 hosts, becomes server sees var as 5, player 2 joins prints out var and its 0 not 5.