mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
fix host mode debug colors
This commit is contained in:
parent
3f0dbadf34
commit
aad1456afd
@ -171,14 +171,16 @@ public void AddPredictedForceAtPosition(Vector3 force, Vector3 position, ForceMo
|
|||||||
protected void BeginPredicting()
|
protected void BeginPredicting()
|
||||||
{
|
{
|
||||||
predictedRigidbody.isKinematic = false; // full physics sync
|
predictedRigidbody.isKinematic = false; // full physics sync
|
||||||
|
|
||||||
// collision checking is disabled while following.
|
// collision checking is disabled while following.
|
||||||
// enable while predicting again.
|
// enable while predicting again.
|
||||||
predictedRigidbody.detectCollisions = true;
|
predictedRigidbody.detectCollisions = true;
|
||||||
|
|
||||||
state = ForecastState.PREDICTING;
|
state = ForecastState.PREDICTING;
|
||||||
|
|
||||||
#if UNITY_EDITOR // PERF: only access .material in Editor, as it may instantiate!
|
#if UNITY_EDITOR // PERF: only access .material in Editor, as it may instantiate!
|
||||||
if (debugColors) rend.material.color = predictingColor;
|
// only show debug colors in client-only mode when predicting
|
||||||
|
if (debugColors && isClientOnly) rend.material.color = predictingColor;
|
||||||
#endif
|
#endif
|
||||||
// we want to predict until the first server state for our [Command] AddForce came in.
|
// we want to predict until the first server state for our [Command] AddForce came in.
|
||||||
// we know the time when our [Command] arrives on server: NetworkTime.predictedTime.
|
// we know the time when our [Command] arrives on server: NetworkTime.predictedTime.
|
||||||
@ -205,17 +207,19 @@ protected void BeginFollowing()
|
|||||||
{
|
{
|
||||||
predictedRigidbody.isKinematic = true; // full transform sync
|
predictedRigidbody.isKinematic = true; // full transform sync
|
||||||
state = ForecastState.FOLLOWING;
|
state = ForecastState.FOLLOWING;
|
||||||
|
|
||||||
#if UNITY_EDITOR // PERF: only access .material in Editor, as it may instantiate!
|
#if UNITY_EDITOR // PERF: only access .material in Editor, as it may instantiate!
|
||||||
if (debugColors) rend.material.color = originalColor;
|
// only show debug colors in client-only mode when predicting
|
||||||
|
if (debugColors && isClientOnly) rend.material.color = originalColor;
|
||||||
#endif
|
#endif
|
||||||
// reset the collision chain depth so it starts at 0 again next time
|
// reset the collision chain depth so it starts at 0 again next time
|
||||||
remainingCollisionChainDepth = 0;
|
remainingCollisionChainDepth = 0;
|
||||||
|
|
||||||
// perf: setting kinematic rigidbody's positions still causes
|
// perf: setting kinematic rigidbody's positions still causes
|
||||||
// significant physics overhead on low end devices.
|
// significant physics overhead on low end devices.
|
||||||
// try disable collisions while purely following.
|
// try disable collisions while purely following.
|
||||||
predictedRigidbody.detectCollisions = false;
|
predictedRigidbody.detectCollisions = false;
|
||||||
|
|
||||||
OnBeginFollow();
|
OnBeginFollow();
|
||||||
// Debug.Log($"{name} BEGIN FOLLOW");
|
// Debug.Log($"{name} BEGIN FOLLOW");
|
||||||
}
|
}
|
||||||
@ -257,7 +261,7 @@ void Update()
|
|||||||
{
|
{
|
||||||
if (isClientOnly) UpdateClient();
|
if (isClientOnly) UpdateClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkTransform improvement: server broadcast needs to run in LateUpdate
|
// NetworkTransform improvement: server broadcast needs to run in LateUpdate
|
||||||
// after other scripts may changed positions in Update().
|
// after other scripts may changed positions in Update().
|
||||||
// otherwise this may run before user update, delaying detection until next frame.
|
// otherwise this may run before user update, delaying detection until next frame.
|
||||||
|
Loading…
Reference in New Issue
Block a user