diff --git a/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs b/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs index efedbb672..a30f5d9c0 100644 --- a/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs +++ b/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs @@ -99,18 +99,9 @@ public abstract class NetworkTransformBase : NetworkBehaviour public Color overlayColor = new Color(0, 0, 0, 0.5f); // initialization ////////////////////////////////////////////////////// - // make sure to call this when inheriting too! - protected virtual void Awake() + // forcec configuration of some settings + protected virtual void Configure() { - // set target to self if none yet. - // OnValidate() already does this, but sometimes OnValidate() doesn't run before launching a project. - if (target == null) target = transform; - } - - protected override void OnValidate() - { - base.OnValidate(); - // set target to self if none yet if (target == null) target = transform; @@ -126,6 +117,22 @@ protected override void OnValidate() if (coordinateSpace == CoordinateSpace.World) syncScale = false; } + // make sure to call this when inheriting too! + protected virtual void Awake() + { + // sometimes OnValidate() doesn't run before launching a project. + // need to guarantee configuration runs. + Configure(); + } + + protected override void OnValidate() + { + base.OnValidate(); + + // configure in awake + Configure(); + } + // snapshot functions ////////////////////////////////////////////////// // get local/world position protected virtual Vector3 GetPosition() =>