#4.2.0 PRO Generates false warning when parenting NetworkObjects

17 messages · Page 1 of 1 (latest)

viscid tapir
#

I'm getting

*"PlayerCharacter(Clone) [Id 62] is childed but the parent MainRoom does not contain a NetworkBehaviour component. To synchronize parents the parent object must have a NetworkBehaviour component, even if empty." *

when parenting NetworkObjects with NetworkObject.SetParent(), even though my parent gameobjects do have NetworkBehaviours. The objects are parented correctly in the hierarchy.
Child gameobjects in question also appear in wrong positions on clients.

Adding EmptyNetworkBehaviour -component to parents did not affect.
Rolling back to previous version (4.1.6) removes the issue.

still spruce
#

Hey there, I can't see this myself when I tried it. Is there anything specific that I need to do, or is parenting the player to an object in the scene with that method enough to cause it?

viscid tapir
sand pumice
#

I have the same issue

viscid tapir
#

I made a demo project from scratch, but was not able to replicate the issue there.
Same FishNet version.
Same Unity version.
hmmm

waxen flicker
viscid tapir
unreal rock
#

I too have this issue in version (4.2.0)! Rolling back to 4.1.6 fixed it for me too.

waxen flicker
#

The only thing that was changed that may have an impact is the Read/Write NetworkConnectionId. Id imagine though wed be seeing way more problems if those were not working.

waxen flicker
#

@unreal rock@viscid tapirMay have found the issue

#

Replace this method in NetworkTransform with provided below

#
        private void UpdateParentBehaviour()
        {
            if (!_synchronizeParent)
                return;
            //No permissions to set.
            if (!CanControl())
                return;

            Transform parent = transform.parent;
            //No parent.
            if (parent == null)
            {
                /* Check for being set without using nob.SetParent.
                 * Only check if was previously set inside this component; otherwise
                 * this would spam anytime the parent was null. */
                if (base.NetworkObject.RuntimeParentNetworkBehaviour != null)
                    Debug.LogWarning($"{gameObject.name} parent object was removed without calling UnsetParent. Use networkObject.UnsetParent() to remove a NetworkObject from it's parent. This is being made a requirement in Fish-Networking v4.");

                ParentBehaviour = null;
                _parentTransform = null;
            }
            //Has a parent, see if eligible.
            else
            {
                //No change.
                if (_parentTransform == parent)
                    return;

                _parentTransform = parent;
                NetworkBehaviour outParentBehaviour;
                
                if (!parent.TryGetComponent<NetworkBehaviour>(out outParentBehaviour))
                {
                    ParentBehaviour = null;
                    LogInvalidParent();
                }
                else
                {
                    ParentBehaviour = outParentBehaviour;
                    //Check for being set without using nob.SetParent.
                    if (base.NetworkObject.CurrentParentNetworkBehaviour != ParentBehaviour)
                        Debug.LogWarning($"{gameObject.name} parent was set without calling SetParent. Use networkObject.SetParent(obj) to assign a NetworkObject a new parent. This is being made a requirement in Fish-Networking v4.");
                }
            }
        }
viscid tapir
unreal rock
waxen flicker
#

@unreal rock@viscid tapirty both for getting back