- Home /
Detecting when a component has been pasted onto an inactive object
Hey everyone,
As the title says. I am creating a custom inspector that works by creating and hiding subcomponents. So when I use the context menu to copy component (by right clicking on it in the inspector) and paste it onto a new object it will detect its on a new object and clone the subcomponents.
This works great but not when I paste the component onto a gameobject that is inactive. In short:
Using the ExecuteInEditMode tag are there any methods that will run whilst the object is disabled? (Already tried Start, Awake, OnEnable, OnDisable and Update. None seem to be called)
Are there any methods I could hook into when Unity pastes a new component?
My backup alternative is to have something scan the currently selected object every frame (whilst in edit mode) but I would rather avoid that purely from a design point of view. Any thoughts on the subject?
Cheers! Jason
Answer by Bunny83 · May 11, 2015 at 10:57 AM
You can try the Reset callback. However i'm not sure if it is called when you "copy & paste" a component. Reset is called once the component is attached to a gameobject and when the user selects "Reset" in the menu.
Your answer
![](https://koobas.hobune.stream/wayback/20220613195322im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Create varying numbers of gameObjects/prefabs in sceneview? 0 Answers
How to create instance from model without creating a clone? 2 Answers
Generate 2 gameobjects as child 2 Answers
Programatically instantiating GameObjects to the editor (not during gameplay) 2 Answers
in-editor cloning of game objects 1 Answer