-
Notifications
You must be signed in to change notification settings - Fork 450
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
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
e73a720
networkobject parent tracking
0xFA11 ea6b6e7
NetworkConstants.PARENT_SYNC = 16
0xFA11 68c1812
minor nullptr fix
0xFA11 2df134d
minor cleanup
0xFA11 a175ef3
sync networkobject reparenting props
0xFA11 3c03ddb
parent sync with orphan children
0xFA11 dac2e0f
sync reparenting at runtime
0xFA11 e161d73
working poc
0xFA11 e5eaf2a
more networkobject parenting restrictions (IsListening && IsServer &&…
0xFA11 33fb6ac
minor fix
0xFA11 342495b
cleanup
0xFA11 8151633
Merge branch 'develop' into feat/reparent
0xFA11 1766b58
minor update: exception message
0xFA11 86a1532
nullptr check
0xFA11 d7a4a3c
reset networkobject.orphanchildren set on networkmanager.initialize
0xFA11 3588afe
NetworkBehaviour.OnNetworkObjectParentChanged
0xFA11 91a5358
Merge branch 'develop' into feat/reparent
0xFA11 73d6431
do not pop invalid moves to the root
0xFA11 778d60f
NetworkObject.TrySetParent & InvalidParentException
0xFA11 1025dbf
bool flag to enable/disable
0xFA11 e7782d7
Merge branch 'develop' into feat/reparent
0xFA11 cddb332
Merge branch 'develop' into feat/reparent
0xFA11 0c593ff
implement networkobject runtime tests
0xFA11 e52f623
Merge branch 'develop' into feat/reparent
0xFA11 e3f43cb
./standards.py --fix
0xFA11 ca90125
revert SampleScene changes
0xFA11 43b6e08
revert SampleScene.unity changes
0xFA11 964a1cf
delete NetworkDevDebug script
0xFA11 8e2863f
implement ReparentingCubeNetBhv to track new NetworkObject parent in …
0xFA11 26bc467
clarify namings
0xFA11 d524131
compare InstanceIDs instead of Transforms
0xFA11 617c1bb
debug PrintHierarchy
0xFA11 acbe66d
better log printing
0xFA11 e5882ee
increase frame wait time
0xFA11 a5941f6
more granular logs
0xFA11 37eeee1
add netobj id to logs
0xFA11 3b8e802
add more verbose logs
0xFA11 c602862
try with host mode
0xFA11 d699581
targetframerate & more logs craziness
0xFA11 326c7ab
let's see
0xFA11 db40b35
TARGETFRAMERATE?!?!11!!1
0xFA11 92d369c
cleanup
0xFA11 40b45fe
50fps
0xFA11 33bf226
add placeholder OnNetworkObjectParentChanged callback handler
0xFA11 235aea6
more comments and warning log
0xFA11 6df1324
hey hey Yamato
0xFA11 50d1cf3
move child NetworkObject to the root on parent NetworkObject destroy
0xFA11 309398f
Merge branch 'develop' into feat/reparent
0xFA11 0ea6dec
downgrade PARENT_SYNC log to Developer from Warning as we expect it t…
0xFA11 4c6534e
Merge branch 'develop' into feat/reparent
0xFA11 7217098
remove Application.targetFrameRate trick
0xFA11 f2876d2
Merge branch 'develop' into feat/reparent
0xFA11 8619915
Merge branch 'develop' into feat/reparent
0xFA11 467fe99
merge branch 'develop' into 'feat/reparent'
0xFA11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
using MLAPI.NetworkVariable; | ||
using MLAPI.Transports; | ||
using UnityEngine; | ||
using UnityEngine.Serialization; | ||
|
||
namespace MLAPI.Prototyping | ||
{ | ||
|
@@ -41,24 +40,20 @@ public enum Authority | |
/// TODO MTT-766 once we have per var interpolation | ||
/// Enable interpolation | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
[FormerlySerializedAs("m_InterpolatePosition")] | ||
[SerializeField, Tooltip("This requires AssumeSyncedSends to be true")] | ||
public bool InterpolatePosition = true; | ||
|
||
/// <summary> | ||
/// TODO MTT-766 once we have per var interpolation | ||
/// The distance before snaping to the position | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
[SerializeField, Tooltip("The transform will snap if the distance is greater than this distance")] | ||
public float SnapDistance = 10f; | ||
|
||
/// <summary> | ||
/// TODO MTT-766 once we have per var interpolation | ||
/// Should the server interpolate | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
[SerializeField] | ||
public bool InterpolateServer = true; | ||
|
||
|
@@ -68,23 +63,20 @@ public enum Authority | |
/// The setting in the NetworkTransform would be to just apply it to our netvars when available | ||
/// The min meters to move before a send is sent | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
[SerializeField, Tooltip("The min meters to move before a send is sent")] | ||
public float MinMeters = 0.15f; | ||
|
||
/// <summary> | ||
/// TODO MTT-767 once we have this per var setting | ||
/// The min degrees to rotate before a send is sent | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
[SerializeField, Tooltip("The min degrees to rotate before a send is sent")] | ||
public float MinDegrees = 1.5f; | ||
|
||
/// <summary> | ||
/// TODO MTT-767 once we have this per var setting | ||
/// The min meters to scale before a send is sent | ||
/// </summary> | ||
// ReSharper disable once NotAccessedField.Global | ||
[SerializeField, Tooltip("The min meters to scale before a send is sent")] | ||
public float MinSize = 0.15f; | ||
|
||
|
@@ -178,7 +170,7 @@ private void SetWorldScale(Vector3 globalScale) | |
m_Transform.localScale = new Vector3(globalScale.x / lossyScale.x, globalScale.y / lossyScale.y, globalScale.z / lossyScale.z); | ||
} | ||
|
||
private bool CanUpdateTransform() | ||
public bool CanUpdateTransform() | ||
{ | ||
return (IsClient && TransformAuthority == Authority.Client && IsOwner) || (IsServer && TransformAuthority == Authority.Server) || TransformAuthority == Authority.Shared; | ||
} | ||
|
@@ -221,6 +213,11 @@ void SetupVar<T>(NetworkVariable<T> v, T initialValue, ref T oldVal) | |
} | ||
} | ||
|
||
public override void OnNetworkObjectParentChanged(NetworkObject parentNetworkObject) | ||
{ | ||
// TODO: handle parent NetworkObject change and potentially optimize pos/rot/scale replication? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
|
||
private NetworkVariable<T>.OnValueChangedDelegate GetOnValueChangedDelegate<T>(Action<T> assignCurrent) | ||
{ | ||
return (old, current) => | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.