Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Katerlad opened this issue Mar 29, 2024 · 10 comments
Labels
Low Priority This task will be resolved when time permits.

Comments

@Katerlad
Copy link

Katerlad commented Mar 29, 2024

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
Copy link
Author

If this is such a small use case that it gets passed off, I can see that, however... I ran into it and it took hours of my day to figure it out, which pissed me off enough to deep dive into it so others who may build prefabs like me do not run into similar problems.

@FirstGearGames
Copy link
Owner

Do you know if this happens in V4? If not, going to mark this as wont fix.

@FirstGearGames FirstGearGames added the Waiting For Information Not enough information has been supplied to resolve this issue. label Apr 5, 2024
@Katerlad
Copy link
Author

Katerlad commented Apr 5, 2024

I'll load up the example project and upgrade to 4 and see. Give me like 1 hour.

@Katerlad
Copy link
Author

Katerlad commented Apr 5, 2024

Yes doing the same steps as above in that exact order causes the problem in 4.1.6.

It just seems like there is some cleanup and checks that need to be done on the fishnet side, when a prefab is being created from a child of another prefab.

I Know some people run into the the initial warning all the time, but after removing the network object and let fishnet auto reapply it, the problem goes away.

If you do more things while the problem exists, then you get stuck in this state where everything is corrupt and you have to remove the Network Behavior. Luckily I did test that you can copy component values, and paste them so you don't lost all your preset variables.

But if there is a way for Fishnet to more gracefully handle these prefab scenarios, less people will have to bump into these small snags that add up.

Again though, there may be some unity limitation that is why this is happening and there isnt, anything you can do but IDK if you've really looked into it either ;)

@FirstGearGames FirstGearGames added Bug Something isn't working Low Priority This task will be resolved when time permits. and removed Waiting For Information Not enough information has been supplied to resolve this issue. labels Apr 6, 2024
@FirstGearGames
Copy link
Owner

Marked a bug, low priority for now.

@makcimbx
Copy link

makcimbx commented Apr 7, 2024

For me, i commented automatically add NetworkObject line in TryAddNetworkObject method from NetworkBehaviour, that make prefab broken, so i do everything manual.
image
Also i add button, for prefab regenerate nested network objects, that also helps.
image
After this, everything almost always works well.

@FirstGearGames FirstGearGames added Bug - Editor Issue only affects the editor view and not runtime behavior. and removed Bug Something isn't working labels Apr 9, 2024
@FirstGearGames
Copy link
Owner

Is this still an issue @Katerlad ? That system got a big rework recently.

@FirstGearGames FirstGearGames added Waiting For Information Not enough information has been supplied to resolve this issue. and removed Bug - Editor Issue only affects the editor view and not runtime behavior. labels Oct 5, 2024
@FirstGearGames
Copy link
Owner

FirstGearGames commented Oct 12, 2024

Queued to close in 2 weeks if there is no new activity.

@Katerlad
Copy link
Author

I unfortunately do not have the time to test this out, I did see that someone commented on the priority help post I made in discord with the same issue asking if this is going to be fixed. Not sure if he was running into the same exact problem or not. Here is the link to the discord post where the other user mentioned he had the same problem.

https://discord.com/channels/424284635074134018/1223395408743497791

@FirstGearGames
Copy link
Owner

No worries. I'll get to it eventually.

@FirstGearGames FirstGearGames removed the Waiting For Information Not enough information has been supplied to resolve this issue. label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Low Priority This task will be resolved when time permits.
Projects
None yet
Development

No branches or pull requests

3 participants