Skip to content

feat: NetworkObject Parenting #855

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

Merged
merged 54 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e73a720
networkobject parent tracking
0xFA11 May 23, 2021
ea6b6e7
NetworkConstants.PARENT_SYNC = 16
0xFA11 May 23, 2021
68c1812
minor nullptr fix
0xFA11 May 23, 2021
2df134d
minor cleanup
0xFA11 May 23, 2021
a175ef3
sync networkobject reparenting props
0xFA11 May 23, 2021
3c03ddb
parent sync with orphan children
0xFA11 May 23, 2021
dac2e0f
sync reparenting at runtime
0xFA11 May 23, 2021
e161d73
working poc
0xFA11 May 23, 2021
e5eaf2a
more networkobject parenting restrictions (IsListening && IsServer &&…
0xFA11 May 24, 2021
33fb6ac
minor fix
0xFA11 May 24, 2021
342495b
cleanup
0xFA11 May 24, 2021
8151633
Merge branch 'develop' into feat/reparent
0xFA11 May 24, 2021
1766b58
minor update: exception message
0xFA11 May 25, 2021
86a1532
nullptr check
0xFA11 May 25, 2021
d7a4a3c
reset networkobject.orphanchildren set on networkmanager.initialize
0xFA11 May 25, 2021
3588afe
NetworkBehaviour.OnNetworkObjectParentChanged
0xFA11 May 27, 2021
91a5358
Merge branch 'develop' into feat/reparent
0xFA11 May 31, 2021
73d6431
do not pop invalid moves to the root
0xFA11 Jun 1, 2021
778d60f
NetworkObject.TrySetParent & InvalidParentException
0xFA11 Jun 2, 2021
1025dbf
bool flag to enable/disable
0xFA11 Jun 2, 2021
e7782d7
Merge branch 'develop' into feat/reparent
0xFA11 Jun 3, 2021
cddb332
Merge branch 'develop' into feat/reparent
0xFA11 Jun 3, 2021
0c593ff
implement networkobject runtime tests
0xFA11 Jun 5, 2021
e52f623
Merge branch 'develop' into feat/reparent
0xFA11 Jun 5, 2021
e3f43cb
./standards.py --fix
0xFA11 Jun 5, 2021
ca90125
revert SampleScene changes
0xFA11 Jun 5, 2021
43b6e08
revert SampleScene.unity changes
0xFA11 Jun 5, 2021
964a1cf
delete NetworkDevDebug script
0xFA11 Jun 5, 2021
8e2863f
implement ReparentingCubeNetBhv to track new NetworkObject parent in …
0xFA11 Jun 5, 2021
26bc467
clarify namings
0xFA11 Jun 5, 2021
d524131
compare InstanceIDs instead of Transforms
0xFA11 Jun 5, 2021
617c1bb
debug PrintHierarchy
0xFA11 Jun 5, 2021
acbe66d
better log printing
0xFA11 Jun 5, 2021
e5882ee
increase frame wait time
0xFA11 Jun 5, 2021
a5941f6
more granular logs
0xFA11 Jun 5, 2021
37eeee1
add netobj id to logs
0xFA11 Jun 5, 2021
3b8e802
add more verbose logs
0xFA11 Jun 5, 2021
c602862
try with host mode
0xFA11 Jun 5, 2021
d699581
targetframerate & more logs craziness
0xFA11 Jun 5, 2021
326c7ab
let's see
0xFA11 Jun 5, 2021
db40b35
TARGETFRAMERATE?!?!11!!1
0xFA11 Jun 5, 2021
92d369c
cleanup
0xFA11 Jun 5, 2021
40b45fe
50fps
0xFA11 Jun 6, 2021
33bf226
add placeholder OnNetworkObjectParentChanged callback handler
0xFA11 Jun 7, 2021
235aea6
more comments and warning log
0xFA11 Jun 7, 2021
6df1324
hey hey Yamato
0xFA11 Jun 8, 2021
50d1cf3
move child NetworkObject to the root on parent NetworkObject destroy
0xFA11 Jun 8, 2021
309398f
Merge branch 'develop' into feat/reparent
0xFA11 Jun 8, 2021
0ea6dec
downgrade PARENT_SYNC log to Developer from Warning as we expect it t…
0xFA11 Jun 9, 2021
4c6534e
Merge branch 'develop' into feat/reparent
0xFA11 Jun 9, 2021
7217098
remove Application.targetFrameRate trick
0xFA11 Jun 9, 2021
f2876d2
Merge branch 'develop' into feat/reparent
0xFA11 Jun 10, 2021
8619915
Merge branch 'develop' into feat/reparent
0xFA11 Jun 11, 2021
467fe99
merge branch 'develop' into 'feat/reparent'
0xFA11 Jun 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
do not pop invalid moves to the root
  • Loading branch information
0xFA11 committed Jun 1, 2021
commit 73d64313a1d1f8a2ee6b725eb5813a48e70dd2b5
14 changes: 6 additions & 8 deletions com.unity.multiplayer.mlapi/Runtime/Core/NetworkObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -558,19 +558,17 @@ private void OnTransformParentChanged()
if (parentTransform != null)
{
var parentObject = transform.parent.GetComponent<NetworkObject>();
if (parentObject != null)
{
m_LatestParent = parentObject.NetworkObjectId;
}
else
if (parentObject == null)
{
transform.parent = m_CachedParent;
if (NetworkLog.CurrentLogLevel <= LogLevel.Error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not really part of your review, but this if should really be part of NetworkLog.LogError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to me, I'd throw away the NetworkLog entirely LOL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

meh I do like the developer level logs. I agree eventually we should have network traces to replace them, but it's a good thing we can enable/disable them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have developer-level logs, it's called Debug.Log suite and if you were to look at NetworkLog closely, it's just a thin layer on top of Debug.Log which serves very little value IMHO.

{
NetworkLog.LogError($"Invalid parenting, {nameof(NetworkObject)} moved under a non-{nameof(NetworkObject)} parent, will fix and move to the scene root");
NetworkLog.LogError($"Invalid parenting, {nameof(NetworkObject)} moved under a non-{nameof(NetworkObject)} parent");
}

m_LatestParent = null;
return;
}

m_LatestParent = parentObject.NetworkObjectId;
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions testproject/Assets/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.