FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

Multiple Nested Prefab Can Cause Errors That Happen At Startup of Game That Doesn't Allow Fishnet to work after Initial Startup.

Open Katerlad opened this issue 1 year ago • 9 comments

General Unity version: Fish-Networking version: 3.11.18 Discord link: https://discord.com/channels/424284635074134018/1223395408743497791 ** Above, post a link from our Discord where you troubleshot the issue (on Discord click the three dots next to the message, then Copy Message Link). Issue may be closed out if this is not included.

Description A clear and concise description of what the bug is.

Please Read Carefully, this isn't

just the spamming of the tryAddComponent Warning, there is something bigger at play here.

When Creating Nested Prefabs with Network Behaviors on the prefab, the NetworkManager can get in a state where it AssetHashPath Errors occur and NetworkManager Becomes null on game startup.

Replication Steps to reproduce the behavior:

  • Project is currently in this state so just hit play to see the error.

There are a couple different ways to get it into this state, but here is the way I found works the most. To Reproduce

  1. Create Parent Prefab in your project and Open it.
  2. Add Empty Network Behaviour.
  3. Create Child Object inside the prefab. (Do not make it a prefab yet)
  4. Add a Empty Network Behaviour to it.
  5. Create a SubChild Object (Do not make it a prefab yet)
  6. Add Empty Network Behaviour to it.
  7. Create a Second SubChild Object under "Child" object ( Do not make it a prefab yet)
  8. Add a Empty Network Behaviour to it.
  9. Drag SubChild Object into your project, (This makes it a prefab)
  10. Notice your cursor starts spinning and glitching. (This I believe is Fishnet trying to add a Network Object to the Prefab but failing) Spaming the TryAddComponent Warning.
  11. Drag SubChild2 Object into your project (This makes it a prefab)
  12. This also makes your cursor spin and glitch.
  13. Drag Child Object into project ( This makes this a prefab with 2 subchild Prefabs beneath it.
  14. Start game, only 1 AssetHashPath Error will appear.
  15. Open Each Prefab in your project by double clicking it (Parent, Child, SubChild, and SubChild2)
  16. Try running game agian.
  17. Notice errors, and NetworkManager Null Error, causing Fishnet not to work in Game.
  • This is where game gets into a state that you have to fix the prefabs problem but It is not easily fixable you cannot just remove the Network Object in the prefabs so fishnet can just regenerate them. Like other people with just the Spamming of the warning.

You have to remove the network behavior itself and read it, and imagine having to do that on a bigger project where you have varioables all set up ( Thats what we had to do)

Expected behavior I expect to be able to add and remove Nested Prefabs to a Prefab and fishnet gracefully handle any use case thats thrown at it. Cleaning up the game object properly if possible without Unity Limitations.

Game Build Files See Build File Below to see Issue in action ChildPrefabBug.zip

Katerlad avatar Mar 29 '24 23:03 Katerlad