-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Detach but no longer active objects fail to set parent #818
Comments
Can you elaborate on what parts you're adding these, or what lines you are modifying? |
Not sure if line numbers will help as much since those can change. In ResetState() in ChildTransformTickSmoother.cs at line 654, change : To: And, NetworkObject.cs line 533 in NetworkBehaviour_OnDestroy, change: void NetworkBehaviour_OnDestroy() { foreach (NetworkBehaviour nb in NetworkBehaviours) { nb.NetworkBehaviour_OnDestroy(); } } To: Also, I've recently encountered another issue in NetworkObject at line 518-ish where a NetworkObject in the RunTimeParentNetworkBehaviour can be null by the time the program is shut down. The following fix of adding an extra != null can fix it, as below:
|
Appreciate it. |
Yeah, it's not been marked as resolved yet but will be most likely next
release.
…On Wed, Dec 11, 2024, 3:19 PM FailCake ***@***.***> wrote:
Having the same issue after updating to the latest fishnet version (pro
4.5.6)
41329265-4F05-4747-9604-3087A4628ED4.png (view on web)
<https://github.com/user-attachments/assets/c0b5e795-2207-40a7-b764-41a6444f2744>
—
Reply to this email directly, view it on GitHub
<#818 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGPJC3SUBA7SPHF3EJHNYOD2FCM5DAVCNFSM6AAAAABR76ZK2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZXGAZTINRTGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'm changing the detach check to this, which should only try to reattach if not shutting down the game or stopping play mode if (_detach && !ApplicationState.IsQuitting())
_graphicalObject.SetParent(_rootTransform); The runtimeparent one should already be fixed. |
- Fixed TimeManager.TimePassed negative time comparison (#829). - Added Transport.GetPacketLoss. Only some transports support this feature. - Added Tugboat.GetPacketLoss(bool). - Added Server/ClientAttribute.UseIsStarted to force using IsServer/ClientStarted instead of Initialized. - Fixed conditional NullReferenceException on clientHost when NetworkObserver deinitialized OnDestroy (#812). - Renamed SceneManager.MoveClientHostObjects to MoveClientObjects. - Changed SceneManager.MoveClientObjects now also applies to ClientOnly. - Fixed NullReferenceExceptions on clientHost when rapidly spawning while changing scenes. - Improved removed unnecessary logging for clientHost. - Fixed NetworkObject NullReferenceException during OnDestroy when nested. - Improved sending reconciles on Channel.Reliable now forces them through regardless if replicates run recently. - Fixed Unity bug IL2CPP build crash for RPCs in generic classes. This is a limited work-around; for proper resolution use Unity 2022 or higher. - Fixed OnServerDespawn not invoking via observer builds (thanks gooby!). - Fixed math on Quaterion.Subtract extension. - Fixed RigidbodyPauser unpausing to kinematic states when another Pauser made kinematic. This bug mostly affected OfflineRigidbody. - Fixed invalid read size error when reader deserializers a null list (#837). - Fixed ChildTransformTickSmoother graphics not moving with target when starting as clientHost then disconnecting client. - Fixed ChildTransformTickSmoother moving to incorrect values when graphicalObject had an offset and when using adaptive interpolation. - Fixed replicates not running default data when data was queued but interpolation was not met yet. - Fixed preferred scenes not being set as active scene when SceneManager.SetActiveScene is false (#838). - Fixed NetworkManager reference being null on reconcile and replicate readers, resulting in possible errors when reading types dependent on a NetworkManager. - Fixed harmless NullReferenceException caused by ChildTransformTickSmoother when exiting play/application (#818). - Fixed harmless Multipass Id not found error in Multipass when subsequentially starting server, client, then stopping server (#828). - Improved performance slightly while in development mode when clients disconnect. - Updated Edgegap to 3.0.9. - Added CharacterController prediction demo, featuring: sprint, jumping, stamina, moving platforms, parenting. - Added Rigidbody prediction demo, featuring: NetworkTrigger pickup, speed boost, predicting multiple rigidbodies.
General
Unity version: 6000.0.26f1
Fish-Networking version: 4.5.5R
Discord link: https://discord.com/channels/424284635074134018/851790045534748702/1308093185763049524
Description
When the game shuts down there is a possibility of an object that is no longer active but detached from the parent, as a result the SetParent is attempted on it but it isn't active in the hierarchy and causes an exception during shutdown. In addition, NetworkBehavior can attempt to OnDestroy an already null object during this time as well.
Replication
Steps to reproduce the behavior:
Expected behavior
No exceptions on shutdown.
Code to fix the issue
In ResetState() in ChildTransformTickSmoother.cs:
if (_detach && _graphicalObject.gameObject.activeInHierarchy) { _graphicalObject.SetParent(_rootTransform); }
And, in NetworkObject.cs change network destroy to:
void NetworkBehaviour_OnDestroy() { foreach (NetworkBehaviour nb in NetworkBehaviours) { if (nb != null) nb.NetworkBehaviour_OnDestroy(); } }
The text was updated successfully, but these errors were encountered: