Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data ..

Discussion in 'Cinemachine' started by unity_skPGxJ5XjTl8yw, May 19, 2021.

  1. unity_skPGxJ5XjTl8yw

    unity_skPGxJ5XjTl8yw

    Joined:
    Feb 28, 2021
    Posts:
    3
    Hello,

    i have a prefab which includes a structure like this:



    I want to use this prefab inside two other prefabs to setup the rigs and orbits on instantiation.

    Sadly its not possible to archive that in case of the following error:

    Code (CSharp):
    1. Setting the parent of a transform which resides in a Prefab Asset is disabled to prevent data corruption (GameObject: 'TopRig').
    2. UnityEditor.Undo:SetTransformParent (UnityEngine.Transform,UnityEngine.Transform,string)
    3. Cinemachine.CinemachineFreeLookEditor/CreateRigWithUndo/<>c:<.cctor>b__0_0 (Cinemachine.CinemachineFreeLook,string,Cinemachine.CinemachineVirtualCamera) (at Library/PackageCache/com.unity.cinemachine@2.7.3/Editor/Editors/CinemachineFreeLookEditor.cs:137)
    4. Cinemachine.CinemachineFreeLook:CreateRigs (Cinemachine.CinemachineVirtualCamera[]) (at Library/PackageCache/com.unity.cinemachine@2.7.3/Runtime/Behaviours/CinemachineFreeLook.cs:543)
    5. Cinemachine.CinemachineFreeLook:UpdateRigCache () (at Library/PackageCache/com.unity.cinemachine@2.7.3/Runtime/Behaviours/CinemachineFreeLook.cs:612)
    6. Cinemachine.CinemachineFreeLook:GetRig (int) (at Library/PackageCache/com.unity.cinemachine@2.7.3/Runtime/Behaviours/CinemachineFreeLook.cs:167)
    I try to access the camera like this:

    Code (CSharp):
    1. var cinemachineFreeLookCamera = camera.GetComponentInChildren<CinemachineFreeLook>();
    Is there anything i can do about that?

    Thank you very much