-
-
Notifications
You must be signed in to change notification settings - Fork 758
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
feature request: Support for NT-R to be disabled/enabled during gameplay. #3713
Comments
Does calling ResetState from OnEnable cover this? |
I'l give it a try. |
Nope @MrGadget1024 Easily reproducible in tanks example. Attach NTR remove NTU, host and join via another player. |
Video preview. Kapture.2024-01-25.at.10.18.01.mp4 |
I think I had a similar issue in one of my examples and opted to unspawn > move > respawn to work around it. |
NetworkTransformBase already has this... protected virtual void OnEnable()
{
ResetState();
if (NetworkServer.active)
NetworkIdentity.clientAuthorityCallback += OnClientAuthorityChanged;
}
protected virtual void OnDisable()
{
ResetState();
if (NetworkServer.active)
NetworkIdentity.clientAuthorityCallback -= OnClientAuthorityChanged;
}
public virtual void ResetState()
{
// disabled objects aren't updated anymore.
// so let's clear the buffers.
serverSnapshots.Clear();
clientSnapshots.Clear();
} |
Yep you cannot disable and re-enable NTR like this. Unless you can trick the OnSerialize to set 'initialState' = true. |
NT-R after being disabled (moves) enabled, loses position sync, due to the delta methods.
Needs some kind of resync upon enabling.
Note older NTs and NT unreliable works with this.
Noticed a few places using this method over the years, such as for pickups, vehicles, platforms etc
The text was updated successfully, but these errors were encountered: