docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method TrySetParent

    TrySetParent(Transform, bool)

    Set the parent of the NetworkObject transform.

    Declaration
    public bool TrySetParent(Transform parent, bool worldPositionStays = true)
    Parameters
    Type Name Description
    Transform parent

    The new parent for this NetworkObject transform will be the child of.

    bool worldPositionStays

    If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before.

    Returns
    Type Description
    bool

    Whether or not reparenting was successful.

    TrySetParent(GameObject, bool)

    Set the parent of the NetworkObject transform.

    Declaration
    public bool TrySetParent(GameObject parent, bool worldPositionStays = true)
    Parameters
    Type Name Description
    GameObject parent

    The new parent for this NetworkObject transform will be the child of.

    bool worldPositionStays

    If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before.

    Returns
    Type Description
    bool

    Whether or not reparenting was successful.

    TrySetParent(NetworkObject, bool)

    Set the parent of the NetworkObject transform.

    Declaration
    public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
    Parameters
    Type Name Description
    NetworkObject parent

    The new parent for this NetworkObject transform will be the child of.

    bool worldPositionStays

    If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before.

    Returns
    Type Description
    bool

    Whether or not reparenting was successful.

    In This Article
    Back to top
    Copyright © 2024 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)