Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question How to remove component on a varient prefab which create from a model prefab?

Discussion in 'Prefabs' started by wechat_os_Qy03BarR3U5AgZ1fs0SBA-4bY, Apr 7, 2024.

  1. wechat_os_Qy03BarR3U5AgZ1fs0SBA-4bY

    wechat_os_Qy03BarR3U5AgZ1fs0SBA-4bY

    Joined:
    Aug 11, 2023
    Posts:
    6
    As title, I'm trying to separate component on prefab for server use (ex. MeshRenderer).
    For normal prefab, I can simply delete the object info I want to separate in prefab file like below:

    Code (CSharp):
    1. --- !u!23 &7760476989203230232
    2. MeshRenderer:
    3.   m_ObjectHideFlags: 0
    4.   m_CorrespondingSourceObject: {fileID: 0}
    5.   m_PrefabInstance: {fileID: 0}
    6.   m_PrefabAsset: {fileID: 0}
    7.   m_GameObject: {fileID: 1779501974451566981}
    8.   m_Enabled: 1
    9.   m_CastShadows: 1
    10.   m_ReceiveShadows: 1
    11.   m_DynamicOccludee: 1
    12.   m_StaticShadowCaster: 0
    13.   m_MotionVectors: 1
    14.   m_LightProbeUsage: 1
    15.   m_ReflectionProbeUsage: 1
    16.   m_RayTracingMode: 2
    17.   m_RayTraceProcedural: 0
    18.   m_RenderingLayerMask: 1
    19.   m_RendererPriority: 0
    20.   m_Materials:
    21.   - {fileID: 2100000, guid: 11f6c7fd78910974fb9a064b13b6df1a, type: 2}
    22.   m_StaticBatchInfo:
    23.     firstSubMesh: 0
    24.     subMeshCount: 0
    25.   m_StaticBatchRoot: {fileID: 0}
    26.   m_ProbeAnchor: {fileID: 0}
    27.   m_LightProbeVolumeOverride: {fileID: 0}
    28.   m_ScaleInLightmap: 1
    29.   m_ReceiveGI: 1
    30.   m_PreserveUVs: 0
    31.   m_IgnoreNormalsForChartDetection: 0
    32.   m_ImportantGI: 0
    33.   m_StitchLightmapSeams: 1
    34.   m_SelectedEditorRenderState: 3
    35.   m_MinimumChartSize: 4
    36.   m_AutoUVMaxDistance: 0.5
    37.   m_AutoUVMaxAngle: 89
    38.   m_LightmapParameters: {fileID: 0}
    39.   m_SortingLayerID: 0
    40.   m_SortingLayer: 0
    41.   m_SortingOrder: 0
    42.   m_AdditionalVertexStreams: {fileID: 0}

    But for varient prefab which is created from model, it only has "PrefabInstance" in prefab file, which only has override attribute of components. And I notice that when I remove component in editor, the "m_RemovedComponents" list would add an item, which is the component I remove. But I can't find where the component come from, nor the source prefab.

    So my question is actually: how does a model convert to prefab? And how is this information stored?Can I access it someway?
     
    Last edited: Apr 7, 2024