#Fishnet Pro Version Upgrade causing new exceptions

37 messages · Page 1 of 1 (latest)

chilly oriole
#

I upgraded my project from Fishnet Pro v4.4.7 to 4.5.8
Some Networked Objects are throwing Object was initialized twice without being reset. Object Name [CarriablePutLocation] Id [44] exceptions when loading a scene as the host and later Spawned NetworkObject was expected to exist but does not for Id 48. This may occur if you sent a NetworkObject reference which does not exist, be it destroyed or if the client does not have visibility. on the client side. These objects never get enabled. Wondering what might have changed that's causing this issue now.

magic junco
#

Hi there, if you update to the latest version those errors should all be resolved

#

4.6.4

chilly oriole
#

Still having the same issue Object was initialized twice without being reset. Object Name [CarriablePutLocation] ObjectId [44] OwnerId [-1] GameObject HashCode [-35914]

magic junco
#

Hmm, that's strange. There was a bug with that in one of the older versions, but it was fixed in the latest

chilly oriole
#

can provide more info though not sure what would be useful

#

Attaching the parent prefab, and the only custom script attached to parent

#

script should be no op for 10 out of the 13 cases

magic junco
#

I see, and this happens on the first time you start the server and client, or only on subsequent times?

chilly oriole
#

I've only tried when I start server and client in a lobby scene then loading this scene in as host

#

I load scenes locally per connection (including host) then add connections to the scene. (not thought global scenes)

magic junco
#

Ah I see, and to confirm the problem is happening on the 4.6.4 Pro version of FishNet, and in which version of Unity?

chilly oriole
#

yep fishnet 4.6.4 unity 2022.3.26

still robin
#

@chilly orioleI answered your DMs btw, if you missed it.

There's an upcoming release that has a fix towards OnStop not calling on nested objects. AFAIK the issue was only happening when stopping the server. So if you were to start server, stop server, and start again without exiting play mode issues could occur.

#

I'm not sure if this fix will resolve your issue but I'd be happy to send you the release. Just please keep in mind that while all changes in this release are considered stable they have not been thoroughly tested yet, so make a backup first.

#

Sent package. Going to disappear for a little to take a break.

chilly oriole
#

Tried 4.6.5 and still getting the same issue. For good measure checked if OnStopServer was ever being called on the object, but no

#

I have other nested network objects in the scene, they don't have this problem

chilly oriole
#

So I debugged a little. I see the nested children nobs are first in the cache so they end up getting initialized. Then the parent object gets initialized. After initializing the parent I see there is a conditional check to loop over children nobs and ONLY initialize if they are uninitialized.

/* Only spawn recursively if the nob state is unset.
 * Unset indicates that the nob has not been manually spawned or despawned. */
if (item.gameObject.activeInHierarchy || item.State == NetworkObjectState.Spawned)

But here isn't the if check supposed to be reversed? Currently it allows spawning the child nob ONLY if they are already spawned?
when I reversed the if condition, the error went away.

#

Also had another question around this. If all objects in the queue will be initialized eventually, why is this looping of children necessary?

still robin
#

@chilly oriole it's possible that should be checking for unset, not spawned. Will need to review. Children are supposed to initialize/spawn after the parent, otherwise parent won't be spawned yet over the network if children send first. Where are you seeing children iterate first?

chilly oriole
#

It's in ServerObjects.SetupSceneObjects

Sending SS of cache state mid initialization. Child objs are initialized but parents aren't.
I see the code prioritizes going in the hierarchy of objects first to initialize hierarchy trees first then go index by index in the cache as you said. So Children are supposed to initialize/spawn after the parent makes sense. But because that if check is reversed, the code never ends up initializing the children, only the parents. In this case the first object in the cache LevelGrid is parent of all Counter nobs which each parent a CarriablePutLocation nob. I so happened to have this very specific scenario where my nested nobs are 3 layers deep and my cache order happens to be root obj then 3rd level leaf nobs, then 2nd level Counters. Because the if check immediately fails while attempting to initialize children ofLevelGrid the root nob, we never follow the Initialize children first formula so we instead move in the order nobs appear in the cache. So code ends up initializing root nob then leaf nobs, then move to the mid level Counter nobs where the if check now succeeds because children are spawned and attempt to spawn them again causing the bug. When if check is reversed all nobs initialize properly.

#

the view is for state of List<NetworkObject> cache = SortRootAndNestedByInitializeOrder(sceneNobs); variable

chilly oriole
#

I think I am gonna refrain from having nested NetworkObjects, seems like I am using them excessively and it feels like a bad practice. How do you suggest handling "parenting" of objects over the network?

But would like to figure this issue out as well. Even after the if check fix my nobs are behaving weird (client started toggle is turning false when object is picked up) and clients are still not seeing the objects right rip. Not sure why

chilly oriole
#

Client is getting Spawned NetworkObject was expected to exist but does not for Id 13. This may occur if you sent a NetworkObject reference which does not exist, be it destroyed or if the client does not have visibility. error.

chilly oriole
#

I ended up having to remove item.gameObject.activeInHierarchy from the check altogether. It was causing failures for spawned prefab with nested Nobs that start enabled. Idk if that breaks something else but with these changes it is working fine

So just if (item.State != NetworkObjectState.Spawned)

still robin
chilly oriole
#

kk was able to reproduce in a fresh project. Will make a report

chilly oriole
still robin
#

@chilly oriole I missed you were on an older version. Please update to 4.6.4 and see if it's still there

#

Because there was definitely a variant of that fixed in 4.6.x

chilly oriole
#

oh sorry issue exists in 4.6.5 as well. I did the debugging above on the most recent version you DMed me. I will update the ticket

#

you can update the fishnet vs in the attached proj and the bug will still happen

still robin
#

Gotcha. Thank you for the bug report! @chilly oriole

still robin
#

@chilly oriole I just had a chance to review the report. The file won't download, but also going by the size I suspect it's not exported in our bug report format.