docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetParentSafe

    SetParentSafe(Transform, Transform, bool, bool)

    Change Tranform's parent, but ensures it is properly unpack if transform is part of a prefab (if editor)

    Declaration
    public static void SetParentSafe(this Transform transform, Transform parent, bool worldPositionStays = true, bool undo = true)
    Parameters
    Type Name Description
    Transform transform

    the transform to modify

    Transform parent

    the new parent to set

    bool worldPositionStays

    should the world position remains as local postion

    bool undo

    should an undo operation be recorded

    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)