docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class NetworkTransformChild

    A component to synchronize the position of child transforms of networked objects.

    There must be a NetworkTransform on the root object of the hierarchy. There can be multiple NetworkTransformChild components on an object. This does not use physics for synchronization, it simply synchronizes the localPosition and localRotation of the child transform and lerps towards the recieved values.

    Inheritance
    object
    Object
    Component
    Behaviour
    MonoBehaviour
    NetworkBehaviour
    NetworkTransformChild
    Inherited Members
    NetworkBehaviour.localPlayerAuthority
    NetworkBehaviour.isServer
    NetworkBehaviour.isClient
    NetworkBehaviour.isLocalPlayer
    NetworkBehaviour.hasAuthority
    NetworkBehaviour.netId
    NetworkBehaviour.connectionToServer
    NetworkBehaviour.connectionToClient
    NetworkBehaviour.playerControllerId
    NetworkBehaviour.syncVarDirtyBits
    NetworkBehaviour.syncVarHookGuard
    NetworkBehaviour.SetDirtyBit(uint)
    NetworkBehaviour.ClearAllDirtyBits()
    NetworkBehaviour.OnNetworkDestroy()
    NetworkBehaviour.OnStartServer()
    NetworkBehaviour.OnStartClient()
    NetworkBehaviour.OnStartLocalPlayer()
    NetworkBehaviour.OnStartAuthority()
    NetworkBehaviour.OnStopAuthority()
    NetworkBehaviour.OnRebuildObservers(HashSet<NetworkConnection>, bool)
    NetworkBehaviour.OnSetLocalVisibility(bool)
    NetworkBehaviour.OnCheckObserver(NetworkConnection)
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(string, float)
    MonoBehaviour.InvokeRepeating(string, float, float)
    MonoBehaviour.CancelInvoke(string)
    MonoBehaviour.IsInvoking(string)
    MonoBehaviour.StartCoroutine(string)
    MonoBehaviour.StartCoroutine(string, object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(string)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, out Component)
    Component.TryGetComponent<T>(out T)
    Component.GetComponent(string)
    Component.GetComponentInChildren(Type, bool)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(bool)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, bool)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(bool)
    Component.GetComponentsInChildren<T>(bool, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, bool)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(bool)
    Component.GetComponentsInParent<T>(bool, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(string)
    Component.SendMessageUpwards(string, object, SendMessageOptions)
    Component.SendMessageUpwards(string, object)
    Component.SendMessageUpwards(string)
    Component.SendMessageUpwards(string, SendMessageOptions)
    Component.SendMessage(string, object)
    Component.SendMessage(string)
    Component.SendMessage(string, object, SendMessageOptions)
    Component.SendMessage(string, SendMessageOptions)
    Component.BroadcastMessage(string, object, SendMessageOptions)
    Component.BroadcastMessage(string, object)
    Component.BroadcastMessage(string)
    Component.BroadcastMessage(string, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, bool)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, bool)
    Object.Destroy(Object, float)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, bool)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, float)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    Object.FindObjectOfType<T>()
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.ToString()
    Object.name
    Object.hideFlags
    object.Equals(object, object)
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Networking
    Assembly: com.unity.multiplayer-hlapi.Runtime.dll
    Syntax
    [AddComponentMenu("Network/NetworkTransformChild")]
    [Obsolete("The high level API classes are deprecated and will be removed in the future.")]
    public class NetworkTransformChild : NetworkBehaviour

    Properties

    childIndex

    A unique Identifier for this NetworkTransformChild component on this root object.

    Declaration
    public uint childIndex { get; }
    Property Value
    Type Description
    uint

    clientMoveCallback3D

    A callback function to allow server side validation of the movement of the child object.

    Declaration
    public NetworkTransform.ClientMoveCallback3D clientMoveCallback3D { get; set; }
    Property Value
    Type Description
    NetworkTransform.ClientMoveCallback3D

    interpolateMovement

    The rate to interpolate towards the target position.

    A value of 1 will snap to the position, and lower positive values will interpolate more slowly.

    Declaration
    public float interpolateMovement { get; set; }
    Property Value
    Type Description
    float

    interpolateRotation

    The rate to interpolate to the target rotation.

    A value of 1 will snap to the position, and lower positive values will interpolate more slowly.

    Declaration
    public float interpolateRotation { get; set; }
    Property Value
    Type Description
    float

    lastSyncTime

    The most recent time when a movement synchronization packet arrived for this object.

    Declaration
    public float lastSyncTime { get; }
    Property Value
    Type Description
    float

    movementThreshold

    The distance that an object can move without sending a movement synchronization update.

    This applies to the child object's localPosition, not it's world position.

    Declaration
    public float movementThreshold { get; set; }
    Property Value
    Type Description
    float

    rotationSyncCompression

    How much to compress rotation sync updates.

    Declaration
    public NetworkTransform.CompressionSyncMode rotationSyncCompression { get; set; }
    Property Value
    Type Description
    NetworkTransform.CompressionSyncMode

    sendInterval

    The sendInterval controls how often state updates are sent for this object.

    Declaration
    public float sendInterval { get; set; }
    Property Value
    Type Description
    float

    syncRotationAxis

    Which axis should rotation by synchronized for.

    Declaration
    public NetworkTransform.AxisSyncMode syncRotationAxis { get; set; }
    Property Value
    Type Description
    NetworkTransform.AxisSyncMode

    target

    The child transform to be synchronized.

    Declaration
    public Transform target { get; set; }
    Property Value
    Type Description
    Transform

    targetSyncPosition

    The target position interpolating towards.

    Declaration
    public Vector3 targetSyncPosition { get; }
    Property Value
    Type Description
    Vector3

    targetSyncRotation3D

    The target rotation interpolating towards.

    Declaration
    public Quaternion targetSyncRotation3D { get; }
    Property Value
    Type Description
    Quaternion

    Methods

    GetNetworkChannel()

    This virtual function is used to specify the QoS channel to use for SyncVar updates for this script.

    Using the NetworkSettings custom attribute causes this function to be implemented for this script, but developers can also implement it themselves.

    Declaration
    public override int GetNetworkChannel()
    Returns
    Type Description
    int

    The QoS channel for this script.

    Overrides
    NetworkBehaviour.GetNetworkChannel()

    GetNetworkSendInterval()

    This virtual function is used to specify the send interval to use for SyncVar updates for this script.

    Using the NetworkSettings custom attribute causes this function to be implemented for this script, but developers can also implement it themselves.

    Declaration
    public override float GetNetworkSendInterval()
    Returns
    Type Description
    float

    The time in seconds between updates.

    Overrides
    NetworkBehaviour.GetNetworkSendInterval()

    OnDeserialize(NetworkReader, bool)

    Virtual function to override to receive custom serialization data. The corresponding function to send serialization data is OnSerialize().

    Declaration
    public override void OnDeserialize(NetworkReader reader, bool initialState)
    Parameters
    Type Name Description
    NetworkReader reader

    Reader to read from the stream.

    bool initialState

    True if being sent initial state.

    Overrides
    NetworkBehaviour.OnDeserialize(NetworkReader, bool)

    OnSerialize(NetworkWriter, bool)

    Virtual function to override to send custom serialization data. The corresponding function to send serialization data is OnDeserialize().

    The initialState flag is useful to differentiate between the first time an object is serialized and when incremental updates can be sent. The first time an object is sent to a client, it must include a full state snapshot, but subsequent updates can save on bandwidth by including only incremental changes. Note that SyncVar hook functions are not called when initialState is true, only for incremental updates.

    If a class has SyncVars, then an implementation of this function and OnDeserialize() are added automatically to the class. So a class that has SyncVars cannot also have custom serialization functions.

    The OnSerialize function should return true to indicate that an update should be sent. If it returns true, then the dirty bits for that script are set to zero, if it returns false then the dirty bits are not changed. This allows multiple changes to a script to be accumulated over time and sent when the system is ready, instead of every frame.

    Declaration
    public override bool OnSerialize(NetworkWriter writer, bool initialState)
    Parameters
    Type Name Description
    NetworkWriter writer

    Writer to use to write to the stream.

    bool initialState

    If this is being called to send initial state.

    Returns
    Type Description
    bool

    True if data was written.

    Overrides
    NetworkBehaviour.OnSerialize(NetworkWriter, bool)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)