Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Difference between ReplacePrefabOptions, and what they actually do

Discussion in 'Scripting' started by libra34567, Jun 29, 2018.

  1. libra34567

    libra34567

    Joined:
    Apr 5, 2014
    Posts:
    62
    So I'm running PrefabUtility.ReplacePrefab under editor.

    And i add a component to it before saving to prefab.
    However, when i use the function with ReplacePrefabOption.Default, it keep adding duplicate components to the prefab. And somehow when i changed to ReplacePrefabOption.connectedToPrefab. It only add one.

    I wonder what each options actually does internally.

    Thank you in advance.

    Edit: I'm pretty sure i only use addcomponent only once, and it's only executed once.