Search Unity

Editor Duplication/Paste Prefab problem

Discussion in 'Editor & General Support' started by Deleted User, Jul 30, 2020.

  1. Deleted User

    Deleted User

    Guest

    Hello, when I duplicate or copy and paste a Prefab Instance in the Editor Hierarchy. It calls OnEnable and OnDisable on the parent object. This is a huge issue for my current situation and don't know how to resolve it.

    Code (CSharp):
    1.  
    2. [ExecuteAlways]
    3. public class CopyAndPasteTest : MonoBehaviour
    4. {
    5.     void OnEnable()
    6.     {
    7.         print("CopyAndPasteTest OnEnable");
    8.     }
    9.     void OnDisable()
    10.     {
    11.         print("CopyAndPasteTest OnDisable");
    12.     }
    13. }
    14.