why is OnSyncedStart being called every frame?

I have goggled and searched the forum on this and have found nothing. The API documentation has the following description for OnSyncedStart

Called once when the object becomes active.

In the OnSyncedStart method I am using spawning a couple objects and only expected a couple to spawn. However, they just keep spawning every frame. I attached visual studio to unity with a break point inside the OnSyncedStart and I see that the break point is hit everyframe.

Am I doing something wrong?

Comments

  • Well I learned something new. Apparently if a exception is thrown while executing OnSyncedStart it continues to call OnSyncedStart over and over. I thought it was the fact it was being called over and over causing the exception since it was a stack overflow. However when I commented it out it stoped calling OnSyncedStart every frame.
  • Interesting @Shredder25001, as you looked at documentation OnSyncedStart is supposed to be called only once in a specific game object creation, not twice or more in this same game object.
  • @JeffersonHenrique I am guessing a flag that marks if it has been called already or not was not getting set when an exception is thrown